/* =============================================================================
   Domain Health Monitor — Design System
   ============================================================================= */

:root {
    --color-bg:          #f5f7fa;
    --color-surface:     #ffffff;
    --color-border:      #e2e8f0;
    --color-text:        #1a202c;
    --color-muted:       #718096;

    --color-ok:          #38a169;
    --color-ok-bg:       rgba(56, 161, 105, 0.10);
    --color-warning:     #d69e2e;
    --color-warning-bg:  rgba(214, 158, 46, 0.12);
    --color-critical:    #e53e3e;
    --color-critical-bg: rgba(229, 62, 62, 0.10);
    --color-masked:      #718096;
    --color-masked-bg:   rgba(113, 128, 150, 0.10);
    --color-unknown:     #a0aec0;

    --radius-sm:  4px;
    --radius-md:  8px;
    --radius-lg:  12px;

    --shadow-sm:  0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.08);

    --font-mono: 'Consolas', 'SF Mono', 'Fira Code', monospace;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    margin: 0;
    padding: 24px 32px;
    font-size: 14px;
    line-height: 1.5;
}

/* =============================================================================
   HEADER
   ============================================================================= */
header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 28px;
}

header h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.subtitle { color: var(--color-muted); margin: 2px 0 0; font-size: 13px; }

.scheduler-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 6px 12px;
    font-size: 12px;
    color: var(--color-muted);
    box-shadow: var(--shadow-sm);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 12px;
    color: var(--color-muted);
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: border-color .15s, color .15s;
}
.btn-logout:hover {
    border-color: var(--color-critical);
    color: var(--color-critical);
}

.btn-role-switch {
    padding: 5px 10px;
    background: var(--color-surface);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-md);
    font-size: 11px;
    font-weight: 600;
    color: var(--color-muted);
    cursor: pointer;
    letter-spacing: .04em;
    transition: all .15s;
}
.btn-role-switch:hover              { border-color: #667eea; color: #667eea; border-style: solid; }
.btn-role-switch--sdr               { color: #6b46c1; border-color: #b794f4; border-style: solid; background: #f3e8ff; }

/* Bouton « Sauver & Stop » (arrêt propre du serveur) */
.btn-stop {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 600;
    color: var(--color-muted);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all .15s;
}
.btn-stop:hover {
    border-color: var(--color-critical);
    color: #fff;
    background: var(--color-critical);
}

/* Overlay affiché après l'arrêt du serveur */
.stop-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .78);
    backdrop-filter: blur(3px);
}
.stop-card {
    max-width: 420px;
    text-align: center;
    padding: 34px 40px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg, 12px);
    box-shadow: var(--shadow-lg, 0 10px 40px rgba(0,0,0,.4));
    color: var(--color-text, #222);
}
.stop-card .stop-emoji { font-size: 46px; line-height: 1; }
.stop-card h2          { margin: 12px 0 8px; }
.stop-card p           { color: var(--color-muted); font-size: 14px; line-height: 1.5; margin: 0; }
.stop-card code        { background: var(--color-bg, #eee); padding: 1px 6px; border-radius: 5px; font-size: 13px; }

.dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dot-green  { background: var(--color-ok);      box-shadow: 0 0 6px var(--color-ok); }
.dot-red    { background: var(--color-critical); box-shadow: 0 0 6px var(--color-critical); }
.dot-yellow { background: var(--color-warning);  box-shadow: 0 0 6px var(--color-warning); }

/* =============================================================================
   STAT CARDS
   ============================================================================= */
.stats-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

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

.stat-label  { font-size: 12px; color: var(--color-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.stat-number { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-number--small { font-size: 16px; font-weight: 600; }

.text-critical { color: var(--color-critical) !important; }
.text-warning  { color: var(--color-warning) !important; }
.text-ok       { color: var(--color-ok) !important; }
.text-muted    { color: var(--color-muted) !important; }

/* =============================================================================
   CONTROLS BAR
   ============================================================================= */
.controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.controls-left  { display: flex; align-items: center; gap: 12px; flex: 1; flex-wrap: wrap; }
.controls-right { display: flex; align-items: center; gap: 8px; }

.search-bar {
    padding: 8px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 13px;
    outline: none;
    width: 220px;
    background: var(--color-surface);
    transition: border-color .15s;
}
.search-bar:focus { border-color: #667eea; box-shadow: 0 0 0 2px rgba(102,126,234,.15); }

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

.tag-pill {
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 500;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    cursor: pointer;
    transition: all .15s;
    color: var(--color-text);
}
.tag-pill:hover          { background: #eef2ff; border-color: #667eea; color: #667eea; }
.tag-pill--active        { background: #667eea; border-color: #667eea; color: #fff; }

/* =============================================================================
   COLUMN PANEL
   ============================================================================= */
.col-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}
.col-panel-title   { font-weight: 600; font-size: 13px; margin-bottom: 10px; }
.col-checkboxes    { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.col-check-label   { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.col-check-label input { cursor: pointer; }

/* =============================================================================
   BUTTONS
   ============================================================================= */
.btn {
    padding: 7px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all .15s;
    text-decoration: none;
    white-space: nowrap;
    display: inline-block;
}
.btn--outline {
    background: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-text);
}
.btn--outline:hover { background: #f0f4ff; border-color: #667eea; color: #667eea; }
.btn--primary {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}
.btn--primary:hover { background: #5a6fd8; }

/* =============================================================================
   SYNC BAR
   ============================================================================= */
.sync-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.btn-sync {
    padding: 6px 14px;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    background: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-text);
    transition: all .15s;
}
.btn-sync:hover {
    background: var(--btn-color, #333);
    color: #fff;
    border-color: var(--btn-color, #333);
}
.btn-sync:disabled { opacity: .4; cursor: not-allowed; }
.btn-sync--all {
    background: #2d3748;
    color: #fff;
    border-color: #2d3748;
}
.btn-sync--all:hover { background: #1a202c; }

.sync-status {
    display: flex;
    align-items: center;
    font-size: 12px;
    padding: 5px 12px;
    border-radius: var(--radius-md);
    font-weight: 500;
}
.sync-status--running { background: #ebf4ff; color: #2b6cb0; }
.sync-status--ok      { background: var(--color-ok-bg); color: var(--color-ok); }
.sync-status--error   { background: var(--color-critical-bg); color: var(--color-critical); }

/* =============================================================================
   TABLE
   ============================================================================= */
.table-wrapper {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th {
    background: #f8fafc;
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--color-muted);
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
    cursor: default;
}
th[onclick] { cursor: pointer; }
th[onclick]:hover { color: #667eea; }
th.sort-asc::after  { content: " ↑"; color: #667eea; }
th.sort-desc::after { content: " ↓"; color: #667eea; }

.th-badge {
    display: inline-block;
    margin-left: 5px;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 700;
    vertical-align: middle;
}
.th-badge--1 { background: #fff0f0; color: var(--color-critical); }
.th-badge--2 { background: #fff8e1; color: #b7791f; }
.th-badge--3 { background: #ebf4ff; color: #2b6cb0; }
.th-badge--4 { background: #f3e8ff; color: #6b46c1; }

td {
    padding: 10px 14px;
    border-bottom: 1px solid #f0f4f8;
    vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td      { background: #fafbff; }

.cell-center { text-align: center; }
.cell-date   { font-size: 11px; font-family: var(--font-mono); white-space: nowrap; }
.cell-domain .domain-name    { font-weight: 600; font-family: var(--font-mono); font-size: 12.5px; }
.cell-domain .domain-account { font-size: 11px; color: var(--color-muted); }

/* Row coloring by health */
.row-critical { border-left: 3px solid var(--color-critical); }
.row-warning  { border-left: 3px solid var(--color-warning); }
.row-ok       { border-left: 3px solid transparent; }
.row-unknown  { border-left: 3px solid var(--color-unknown); }

.no-data { text-align: center; color: var(--color-muted); padding: 48px !important; }

/* =============================================================================
   STATUS BADGES & DOTS
   ============================================================================= */
.badge-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-status--ok       { background: var(--color-ok-bg);       color: var(--color-ok); }
.badge-status--warning  { background: var(--color-warning-bg);  color: var(--color-warning); }
.badge-status--critical { background: var(--color-critical-bg); color: var(--color-critical); }
.badge-status--error    { background: var(--color-critical-bg); color: var(--color-critical); }
.badge-status--unknown  { background: #f0f4f8;                  color: var(--color-muted); }
.badge-status--masked   { background: var(--color-masked-bg);   color: var(--color-masked); }

.badge-masked {
    font-size: 11px;
    color: var(--color-masked);
    background: var(--color-masked-bg);
    padding: 2px 7px;
    border-radius: 99px;
}

.status-dot {
    display: inline-block;
    width: 9px; height: 9px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}
.status-dot--ok       { background: var(--color-ok); }
.status-dot--warning  { background: var(--color-warning); }
.status-dot--critical { background: var(--color-critical); animation: pulse-red .9s ease-in-out infinite; }
.status-dot--error    { background: var(--color-critical); }
.status-dot--unknown  { background: var(--color-unknown); }
.status-dot--masked   { background: var(--color-masked); }

.status-label {
    font-size: 11px;
    font-weight: 600;
    vertical-align: middle;
}
.status-label--ok       { color: var(--color-ok); }
.status-label--warning  { color: var(--color-warning); }
.status-label--critical { color: var(--color-critical); }
.status-label--error    { color: var(--color-critical); }
.status-label--unknown  { color: var(--color-muted); }

@keyframes pulse-red {
    0%, 100% { box-shadow: 0 0 0 0 rgba(229,62,62,0.5); }
    50%       { box-shadow: 0 0 0 4px rgba(229,62,62,0); }
}

/* =============================================================================
   TAGS — inline management
   ============================================================================= */
.cell-tags { min-width: 140px; max-width: 280px; }

.tags-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: #eef2ff;
    color: #4c51bf;
    border: 1px solid #c3dafe;
    border-radius: 99px;
    padding: 2px 8px 2px 8px;
    font-size: 11px;
    font-weight: 500;
    cursor: default;
}
.tag-chip span { cursor: pointer; }
.tag-chip span:hover { text-decoration: underline; }

.tag-chip-rm {
    background: none;
    border: none;
    color: #a0aec0;
    font-size: 13px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    margin-left: 2px;
}
.tag-chip-rm:hover { color: var(--color-critical); }

.btn-add-tag {
    background: none;
    border: 1px dashed #cbd5e0;
    border-radius: 99px;
    color: var(--color-muted);
    font-size: 14px;
    line-height: 1;
    width: 22px; height: 22px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
}
.btn-add-tag:hover { background: #eef2ff; border-color: #667eea; color: #667eea; }

.tag-input {
    border: 1px solid #667eea;
    border-radius: 99px;
    padding: 2px 10px;
    font-size: 11px;
    outline: none;
    width: 110px;
    background: var(--color-surface);
}

/* =============================================================================
   ACTION BUTTONS — 🔥 warmup / 🗑️ wipe
   ============================================================================= */
.action-btns { display: flex; gap: 6px; justify-content: center; }

.btn-action {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    width: 32px; height: 32px;
    font-size: 16px;
    cursor: pointer;
    transition: all .15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-action:hover               { background: #f0f4ff; border-color: #667eea; transform: scale(1.15); }
.btn-action:disabled            { opacity: .5; cursor: not-allowed; transform: none; }
a.btn-action                    { text-decoration: none; color: inherit; }

.btn-action--loading {
    animation: spin-fade .7s linear infinite;
    border-color: #667eea;
}
.btn-action--done {
    background: var(--color-ok-bg);
    border-color: var(--color-ok);
}

@keyframes spin-fade {
    0%, 100% { opacity: 1; }
    50%       { opacity: .4; }
}

/* =============================================================================
   TOGGLE SWITCH (alertes)
   ============================================================================= */
.toggle-switch {
    display: inline-block;
    position: relative;
    width: 36px; height: 20px;
    cursor: pointer;
}
.toggle-switch input { display: none; }
.toggle-slider {
    position: absolute; inset: 0;
    border-radius: 99px;
    background: #cbd5e0;
    transition: background .2s;
}
.toggle-slider::before {
    content: "";
    position: absolute;
    width: 14px; height: 14px;
    left: 3px; top: 3px;
    border-radius: 50%;
    background: #fff;
    transition: transform .2s;
    box-shadow: var(--shadow-sm);
}
.toggle-switch input:checked + .toggle-slider            { background: var(--color-ok); }
.toggle-switch input:checked + .toggle-slider::before   { transform: translateX(16px); }

/* =============================================================================
   TOAST
   ============================================================================= */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9999;
}

.toast {
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .25s, transform .25s;
    max-width: 340px;
}
.toast--visible     { opacity: 1; transform: translateY(0); }
.toast--ok          { background: #f0fff4; color: #276749; border: 1px solid #9ae6b4; }
.toast--warning     { background: #fffff0; color: #975a16; border: 1px solid #f6e05e; }
.toast--critical    { background: #fff5f5; color: #c53030; border: 1px solid #feb2b2; }

/* =============================================================================
   BARRE DE CHARGEMENT
   ============================================================================= */
#progress-bar {
    position: fixed;
    top: 0; left: 0;
    height: 3px;
    width: 0%;
    opacity: 0;
    background: linear-gradient(90deg, #4f6ef7, #38b2ac, #4f6ef7);
    background-size: 200% 100%;
    animation: progress-shimmer 1.4s linear infinite;
    z-index: 10000;
    pointer-events: none;
}
@keyframes progress-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* =============================================================================
   BOUTON DÉTAIL PAR LIGNE
   ============================================================================= */
.btn-detail {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 3px 7px;
    font-size: 13px;
    cursor: pointer;
    color: var(--color-muted);
    transition: background .15s, border-color .15s, color .15s;
    line-height: 1;
}
.btn-detail:hover {
    background: #eef2ff;
    border-color: #4f6ef7;
    color: #4f6ef7;
}

/* =============================================================================
   MODAL DÉTAIL BRUT
   ============================================================================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    padding: 24px;
}
.modal-box {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    width: 100%;
    max-width: 960px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}
.modal-title {
    font-weight: 700;
    font-size: 16px;
    font-family: var(--font-mono);
    color: var(--color-text);
}
.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: var(--color-muted);
    padding: 0 4px;
    border-radius: var(--radius-sm);
}
.modal-close:hover { background: var(--color-bg); color: var(--color-text); }
.modal-body {
    overflow: auto;
    padding: 0;
    flex: 1;
}
.detail-tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.detail-tbl thead th {
    background: #f8fafc;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--color-border);
    position: sticky; top: 0;
}
.detail-tbl tbody tr { border-bottom: 1px solid #f0f4f8; }
.detail-tbl tbody tr:last-child { border-bottom: none; }
.detail-tbl td { padding: 9px 12px; vertical-align: top; }
.drow--critical td:first-child { border-left: 3px solid var(--color-critical); }
.drow--error    td:first-child { border-left: 3px solid var(--color-critical); }
.drow--warning  td:first-child { border-left: 3px solid var(--color-warning); }
.drow--ok       td:first-child { border-left: 3px solid transparent; }
.mod-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    letter-spacing: .03em;
    white-space: nowrap;
}
.mono-sm { font-family: var(--font-mono); font-size: 12px; color: #4a5568; }
.detail-txt { max-width: 280px; line-height: 1.4; color: #4a5568; }
.score-val { font-family: var(--font-mono); font-size: 13px; }
.score-val--critical, .score-val--error   { color: var(--color-critical); }
.score-val--warning  { color: var(--color-warning); }
.score-val--ok       { color: var(--color-ok); }
.btn-raw {
    font-size: 11px;
    padding: 2px 7px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: #f8fafc;
    cursor: pointer;
    color: var(--color-muted);
    font-family: var(--font-mono);
    transition: background .12s;
}
.btn-raw:hover { background: #eef2ff; color: #4f6ef7; border-color: #4f6ef7; }
.raw-pre {
    margin: 6px 0 0;
    padding: 8px 10px;
    background: #1e2030;
    color: #a9b1d6;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-family: var(--font-mono);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
    max-width: 320px;
    max-height: 220px;
    overflow: auto;
}

/* =============================================================================
   NOTIFICATION DRAWER — dégradations
   ============================================================================= */
.notif-drawer {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 480px;
    max-height: 420px;
    background: var(--color-surface);
    border: 1.5px solid #f6ad55;
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0,0,0,.16);
    z-index: 8500;
    flex-direction: column;
    overflow: hidden;
}
.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fffbeb;
    border-bottom: 1px solid #fde68a;
    flex-shrink: 0;
}
.notif-title {
    font-weight: 700;
    font-size: 13px;
    color: #92400e;
}
.notif-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #b45309;
    line-height: 1;
    padding: 0 2px;
    border-radius: var(--radius-sm);
}
.notif-close:hover { background: #fde68a; }
.notif-list {
    overflow-y: auto;
    flex: 1;
    padding: 8px 0;
}
.notif-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-bottom: 1px solid #fef3c7;
    font-size: 12px;
}
.notif-item:last-child { border-bottom: none; }
.notif-domain {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--color-text);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.notif-key {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--color-muted);
    background: var(--color-bg);
    padding: 1px 5px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}
.notif-change {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.notif-arrow { color: var(--color-muted); font-size: 11px; }
.notif-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid #fde68a;
    background: #fffbeb;
    flex-shrink: 0;
    gap: 12px;
}
.notif-hint { font-size: 11px; color: #b45309; flex: 1; }

/* ── Modal signatures ────────────────────────────────────────────────── */
.sig-modal-box {
    width: min(860px, 95vw);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
}
.sig-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--color-border);
    flex-wrap: wrap;
}
.sig-controls-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sig-controls-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.sig-all-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
    color: var(--color-text);
}
.sig-count-badge {
    font-size: 12px;
    font-weight: 600;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    padding: 2px 10px;
    color: var(--color-muted);
}
.sig-select {
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 13px;
    min-width: 200px;
    max-width: 320px;
}
.sig-apply-btn {
    white-space: nowrap;
    font-size: 13px;
    padding: 6px 16px;
}
.sig-preview {
    margin: 0 20px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    max-height: 120px;
    font-size: 12px;
}
.sig-preview-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-muted);
    padding: 4px 10px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}
.sig-preview-html {
    padding: 8px 12px;
    overflow-y: auto;
    max-height: 88px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
}
.sig-modal-body {
    overflow-y: auto;
    flex: 1;
    padding: 0 20px 16px;
}
.sig-tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 8px;
}
.sig-tbl th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 8px 8px 6px;
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    background: var(--color-bg);
    z-index: 1;
}
.sig-tbl td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}
.sig-row { cursor: pointer; }
.sig-row:hover { background: var(--color-surface); }
.sig-row:has(.sig-cb:checked) { background: rgba(99,102,241,.08); }
.sig-cb-cell { width: 32px; text-align: center; }
.sig-cur-name { color: var(--color-muted); font-size: 12px; }
.sig-loading {
    text-align: center;
    padding: 32px 0;
    color: var(--color-muted);
    font-size: 13px;
}

/* ── Colonne Activité Emelia (verticale) ─────────────────────────────── */
.cell-ea {
    padding: 6px 10px;
    vertical-align: top;
    min-width: 180px;
    max-width: 300px;
}
.ea-type {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--color-muted);
    margin-bottom: 3px;
}
.ea-status { margin-bottom: 2px; }
.ea-score {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.3;
    margin-bottom: 2px;
}
.ea-detail {
    font-size: 11px;
    color: var(--color-muted);
    line-height: 1.5;
    word-break: break-word;
    white-space: normal;
}

/* ── Colonne État Emelia (🔥 ✉️ 💤 + durées) ─────────────────────────── */
.cell-estat {
    padding: 6px 10px;
    vertical-align: middle;
    white-space: nowrap;
}
.estat-line {
    font-size: 13px;
    line-height: 1.9;
}

/* ── Modal rapport Emelia ────────────────────────────────────────────────── */
.report-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.report-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--color-muted);
}
.report-select,
.report-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
}
.report-select:focus,
.report-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.report-info {
    font-size: 13px;
    padding: 8px 10px;
    border-radius: 6px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
}

/* =============================================================================
   DARK MODE — suit automatiquement la préférence système
   ============================================================================= */
@media (prefers-color-scheme: dark) {
    :root {
        --color-bg:          #0f1117;
        --color-surface:     #181c27;
        --color-border:      #2a3045;
        --color-text:        #e2e8f0;
        --color-muted:       #8896aa;

        --color-ok:          #48bb78;
        --color-ok-bg:       rgba(72, 187, 120, 0.14);
        --color-warning:     #f6c54d;
        --color-warning-bg:  rgba(246, 197, 77, 0.14);
        --color-critical:    #fc8181;
        --color-critical-bg: rgba(252, 129, 129, 0.14);
        --color-masked:      #718096;
        --color-masked-bg:   rgba(113, 128, 150, 0.14);
        --color-unknown:     #4a5568;

        --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
        --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
    }

    /* Table */
    th                            { background: #13161f; }
    td                            { border-bottom-color: #1e2435; }
    tr:hover td                   { background: #1c2133; }

    /* Badges */
    .badge-status--unknown        { background: #1e2435; }

    /* Tags */
    .tag-chip                     { background: #1e2840; color: #818cf8; border-color: #2d3a6b; }
    .btn-add-tag                  { border-color: #2a3045; }
    .btn-add-tag:hover            { background: #1e2840; border-color: #667eea; color: #667eea; }
    .tag-pill:hover               { background: #1e2840; }

    /* Buttons */
    .btn--outline:hover           { background: #1a2040; }
    .btn-action:hover             { background: #1e2840; }
    .btn-sync--all                { background: #252d3d; border-color: #252d3d; }
    .btn-sync--all:hover          { background: #1a2030; }

    /* Sync status */
    .sync-status--running         { background: #0f1f3a; color: #63b3ed; }

    /* TH severity badges */
    .th-badge--1                  { background: #2d1515; }
    .th-badge--2                  { background: #2d2010; color: #f6ad55; }
    .th-badge--3                  { background: #0f1f35; color: #63b3ed; }
    .th-badge--4                  { background: #1e1535; color: #b794f4; }

    /* Role switch SDR state */
    .btn-role-switch--sdr         { background: #1e1535; border-color: #6d4a9e; color: #b794f4; }

    /* Modals / overlays (si fond blanc hardcodé) */
    .modal-box, .detail-panel,
    .sig-modal-box                { background: #181c27; }
    .modal-header, .detail-header { border-bottom-color: #2a3045; }
    .modal-footer, .detail-footer { border-top-color: #2a3045; }

    /* Inputs */
    input, select, textarea       { background: #181c27; color: var(--color-text);
                                    border-color: #2a3045; }
    input::placeholder            { color: #4a5568; }
    /* Liste déroulante native : sinon fond blanc + texte clair = illisible */
    option, optgroup              { background: #181c27; color: var(--color-text); }
}

/* =============================================================================
   THEME TOGGLE BUTTON
   ============================================================================= */
.btn-theme {
    padding: 5px 9px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: border-color .15s;
}
.btn-theme:hover { border-color: #667eea; }

/* =============================================================================
   THEME TOGGLE — override manuel (data-theme sur <html>)
   ============================================================================= */

/* Force dark (système clair + bouton sombre) */
html[data-theme="dark"] {
    --color-bg:          #0f1117;
    --color-surface:     #181c27;
    --color-border:      #2a3045;
    --color-text:        #e2e8f0;
    --color-muted:       #8896aa;
    --color-ok:          #48bb78;
    --color-ok-bg:       rgba(72, 187, 120, 0.14);
    --color-warning:     #f6c54d;
    --color-warning-bg:  rgba(246, 197, 77, 0.14);
    --color-critical:    #fc8181;
    --color-critical-bg: rgba(252, 129, 129, 0.14);
    --color-masked:      #718096;
    --color-masked-bg:   rgba(113, 128, 150, 0.14);
    --color-unknown:     #4a5568;
    --shadow-sm:         0 1px 3px rgba(0,0,0,0.4);
    --shadow-md:         0 4px 16px rgba(0,0,0,0.5);
}
html[data-theme="dark"] th                   { background: #13161f; }
html[data-theme="dark"] td                   { border-bottom-color: #1e2435; }
html[data-theme="dark"] tr:hover td          { background: #1c2133; }
html[data-theme="dark"] .badge-status--unknown { background: #1e2435; }
html[data-theme="dark"] .tag-chip            { background: #1e2840; color: #818cf8; border-color: #2d3a6b; }
html[data-theme="dark"] .btn-add-tag         { border-color: #2a3045; }
html[data-theme="dark"] .btn-add-tag:hover   { background: #1e2840; border-color: #667eea; color: #667eea; }
html[data-theme="dark"] .tag-pill:hover      { background: #1e2840; }
html[data-theme="dark"] .btn--outline:hover  { background: #1a2040; }
html[data-theme="dark"] .btn-action:hover    { background: #1e2840; }
html[data-theme="dark"] .btn-sync--all       { background: #252d3d; border-color: #252d3d; }
html[data-theme="dark"] .btn-sync--all:hover { background: #1a2030; }
html[data-theme="dark"] .sync-status--running { background: #0f1f3a; color: #63b3ed; }
html[data-theme="dark"] .th-badge--1         { background: #2d1515; }
html[data-theme="dark"] .th-badge--2         { background: #2d2010; color: #f6ad55; }
html[data-theme="dark"] .th-badge--3         { background: #0f1f35; color: #63b3ed; }
html[data-theme="dark"] .th-badge--4         { background: #1e1535; color: #b794f4; }
html[data-theme="dark"] .btn-role-switch--sdr { background: #1e1535; border-color: #6d4a9e; color: #b794f4; }
html[data-theme="dark"] .modal-box,
html[data-theme="dark"] .detail-panel,
html[data-theme="dark"] .sig-modal-box       { background: #181c27; }
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .detail-header       { border-bottom-color: #2a3045; }
html[data-theme="dark"] .modal-footer,
html[data-theme="dark"] .detail-footer       { border-top-color: #2a3045; }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea             { background: #181c27; color: var(--color-text); border-color: #2a3045; }
html[data-theme="dark"] input::placeholder   { color: #4a5568; }
html[data-theme="dark"] option,
html[data-theme="dark"] optgroup             { background: #181c27; color: var(--color-text); }
html[data-theme="dark"] .mailbox-sub-row     { background: #0f1117; }
html[data-theme="dark"] .mbox-tbl th        { background: rgba(111,66,193,.12); border-color: #2a3045; }
html[data-theme="dark"] .mbox-tbl td        { border-color: #2a3045; }
html[data-theme="dark"] .mbox-row:hover     { background: rgba(111,66,193,.08); }
html[data-theme="dark"] .btn-expand         { border-color: #2a3045; color: #4a5568; }
html[data-theme="dark"] .btn-expand:hover   { border-color: #a0aec0; color: #a0aec0; }

/* Force light (système sombre + bouton clair) */
@media (prefers-color-scheme: dark) {
    html[data-theme="light"] {
        --color-bg:          #f5f7fa;
        --color-surface:     #ffffff;
        --color-border:      #e2e8f0;
        --color-text:        #1a202c;
        --color-muted:       #718096;
        --color-ok:          #38a169;
        --color-ok-bg:       rgba(56, 161, 105, 0.10);
        --color-warning:     #d69e2e;
        --color-warning-bg:  rgba(214, 158, 46, 0.12);
        --color-critical:    #e53e3e;
        --color-critical-bg: rgba(229, 62, 62, 0.10);
        --color-masked:      #718096;
        --color-masked-bg:   rgba(113, 128, 150, 0.10);
        --color-unknown:     #a0aec0;
        --shadow-sm:         0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
        --shadow-md:         0 4px 12px rgba(0,0,0,0.08);
    }
    html[data-theme="light"] th                   { background: #f8fafc; }
    html[data-theme="light"] td                   { border-bottom-color: #f0f4f8; }
    html[data-theme="light"] tr:hover td          { background: #fafbff; }
    html[data-theme="light"] .badge-status--unknown { background: #f0f4f8; }
    html[data-theme="light"] .tag-chip            { background: #eef2ff; color: #4c51bf; border-color: #c3dafe; }
    html[data-theme="light"] .btn-add-tag         { border-color: #cbd5e0; }
    html[data-theme="light"] .btn-sync--all       { background: #2d3748; border-color: #2d3748; }
    html[data-theme="light"] .sync-status--running { background: #ebf4ff; color: #2b6cb0; }
    html[data-theme="light"] .th-badge--1         { background: #fff0f0; color: #e53e3e; }
    html[data-theme="light"] .th-badge--2         { background: #fff8e1; color: #b7791f; }
    html[data-theme="light"] .th-badge--3         { background: #ebf4ff; color: #2b6cb0; }
    html[data-theme="light"] .th-badge--4         { background: #f3e8ff; color: #6b46c1; }
    html[data-theme="light"] .btn-role-switch--sdr { background: #f3e8ff; border-color: #b794f4; color: #6b46c1; }
    html[data-theme="light"] .modal-box,
    html[data-theme="light"] .detail-panel,
    html[data-theme="light"] .sig-modal-box       { background: #ffffff; }
    html[data-theme="light"] .modal-header,
    html[data-theme="light"] .detail-header       { border-bottom-color: #e2e8f0; }
    html[data-theme="light"] .modal-footer,
    html[data-theme="light"] .detail-footer       { border-top-color: #e2e8f0; }
    /* Restaure les états :hover clairs (m1 @media dark les avait forcés sombres) */
    html[data-theme="light"] .btn-add-tag:hover   { background: #eef2ff; border-color: #667eea; color: #667eea; }
    html[data-theme="light"] .tag-pill:hover      { background: #eef2ff; }
    html[data-theme="light"] .btn--outline:hover  { background: #f0f4ff; }
    html[data-theme="light"] .btn-action:hover    { background: #f0f4ff; }
    html[data-theme="light"] .btn-sync--all:hover { background: #1a202c; }
    html[data-theme="light"] .btn-expand:hover    { border-color: #a0aec0; color: #718096; }
    html[data-theme="light"] input::placeholder   { color: #a0aec0; }
    html[data-theme="light"] input,
    html[data-theme="light"] select,
    html[data-theme="light"] textarea             { background: #ffffff; color: #1a202c; border-color: #e2e8f0; }
    html[data-theme="light"] option,
    html[data-theme="light"] optgroup             { background: #ffffff; color: #1a202c; }
    html[data-theme="light"] .mailbox-sub-row     { background: #f5f7fa; }
    html[data-theme="light"] .mbox-tbl th        { background: rgba(111,66,193,.08); border-color: #e2e8f0; }
    html[data-theme="light"] .mbox-tbl td        { border-color: #e2e8f0; }
    html[data-theme="light"] .mbox-row:hover     { background: rgba(111,66,193,.04); }
    html[data-theme="light"] .btn-expand         { border-color: #e2e8f0; color: #718096; }
}

/* =============================================================================
   MAILBOX SUB-TABLE — Sous-tableau per-boîte mail (expand domaine)
   ============================================================================= */

.domain-row-inner        { display: flex; align-items: center; gap: 8px; }
.btn-expand              { background: none; border: 1px solid var(--color-border);
                           border-radius: var(--radius-sm); color: var(--color-muted);
                           font-size: 9px; padding: 2px 5px; cursor: pointer;
                           line-height: 1; transition: all .15s; flex-shrink: 0; }
.btn-expand:hover        { border-color: var(--color-text); color: var(--color-text); }
.btn-expand--open        { border-color: #6f42c1; color: #6f42c1; background: rgba(111,66,193,.06); }

.mailbox-sub-row         { background: var(--color-bg); }
.mailbox-sub-cell        { padding: 0 !important; border-top: 2px solid #6f42c1 !important; }

.mbox-container          { padding: 10px 16px 14px 44px; }
.mbox-tbl                { width: 100%; border-collapse: collapse; font-size: 12px; }
.mbox-tbl th             { background: rgba(111,66,193,.08); color: var(--color-muted);
                           font-size: 10px; font-weight: 600; text-transform: uppercase;
                           letter-spacing: .04em; padding: 5px 8px; text-align: left;
                           border-bottom: 1px solid var(--color-border); white-space: nowrap; }
.mbox-tbl td             { padding: 5px 8px; border-bottom: 1px solid var(--color-border);
                           white-space: nowrap; }
.mbox-tbl tr:last-child td { border-bottom: none; }
.mbox-row:hover          { background: rgba(111,66,193,.04); }
.mbox-row--disc          { opacity: .6; }

.mbox-email              { font-family: var(--font-mono); font-size: 11px; max-width: 220px;
                           overflow: hidden; text-overflow: ellipsis; }
.mbox-disc               { color: var(--color-critical); margin-left: 4px; font-size: 11px; }
.mbox-camp-name          { font-size: 11px; max-width: 180px; display: inline-block;
                           overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
                           vertical-align: middle; }
.mbox-health             { letter-spacing: 2px; }
.mbox-last               { font-size: 10px; }

.hck                     { font-size: 10px; font-weight: 700; }
.hck--ok                 { color: var(--color-ok); }
.hck--ko                 { color: var(--color-critical); }
.hck--na                 { color: var(--color-unknown); }

/* Dispo mot de passe — badge par boîte (sous-ligne) */
.mbox-mdp                { white-space: nowrap; }
.mdp                     { font-size: 10px; font-weight: 700; padding: 1px 7px;
                           border-radius: 10px; white-space: nowrap; }
.mdp--ok                 { color: var(--color-ok);       background: var(--color-ok-bg); }
.mdp--ko                 { color: var(--color-critical); background: var(--color-critical-bg); }

/* Couverture mot de passe — badge du modal détail */
.mdp-cov                 { font-size: 12px; font-weight: 600; padding: 3px 10px;
                           border-radius: 12px; margin-left: auto; }
.mdp-cov--load           { color: var(--color-muted); }
.mdp-cov--ok             { color: var(--color-ok);       background: var(--color-ok-bg); }
.mdp-cov--ko             { color: var(--color-critical); background: var(--color-critical-bg); }
.mdp-cov--na             { color: var(--color-muted); }

.mbox-empty              { padding: 12px 16px 12px 44px; color: var(--color-muted);
                           font-size: 12px; font-style: italic; }

@media (prefers-color-scheme: dark) {
    .mailbox-sub-row     { background: #0f1117; }
    .mbox-tbl th         { background: rgba(111,66,193,.12); }
    .mbox-tbl td         { border-color: #2a3045; }
    .mbox-tbl th         { border-color: #2a3045; }
    .mbox-row:hover      { background: rgba(111,66,193,.08); }
    .btn-expand          { border-color: #2a3045; color: #4a5568; }
    .btn-expand:hover    { border-color: #a0aec0; color: #a0aec0; }
}

/* =============================================================================
   SIDEBAR — volet de navigation gauche (partagé, cf. templates/_sidebar.html)
   ============================================================================= */
/* Décale le contenu uniquement là où le volet est présent (pas la page login). */
body:has(#app-sidebar) { padding-left: 236px; transition: padding-left .2s ease; }

.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 220px;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    padding: 18px 14px;
    overflow-y: auto;
    z-index: 300;
    transition: width .2s ease, padding .2s ease;
}

.sidebar-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
    padding-bottom: 20px;
}

.sidebar-logo {
    display: block;
    padding: 4px 4px 0 6px;
    color: var(--color-text);          /* pilote le currentColor du wordmark */
    line-height: 0;
    flex: 1;
    min-width: 0;
}
.sidebar-logo svg { width: 100%; height: auto; max-height: 48px; }
.logo-mark { display: none; font: 900 24px 'Arial Black','Segoe UI',sans-serif; color: var(--color-text); }
.logo-mark i { color: #F58220; font-style: normal; }

.sidebar-toggle {
    flex: none;
    width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    color: var(--color-muted);
    cursor: pointer;
    font-size: 14px; line-height: 1;
    transition: border-color .15s, color .15s;
}
.sidebar-toggle:hover { border-color: #F58220; color: #F58220; }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--color-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: background .15s, color .15s, box-shadow .15s;
}
.sidebar-link:hover { background: var(--color-bg); color: var(--color-text); }
.sidebar-link.active {
    background: linear-gradient(90deg, rgba(245,130,32,.15), rgba(245,130,32,.03));
    color: var(--color-text);
    box-shadow: inset 3px 0 0 #F58220;
}

.sb-ico { font-size: 16px; width: 20px; text-align: center; flex: none; }

.sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 16px;
}

.sidebar-action {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}
.sidebar-action:hover { border-color: #F58220; color: #F58220; }
.sidebar-action--logout:hover { border-color: var(--color-critical); color: var(--color-critical); }

.sidebar-profil {
    border-top: 1px solid var(--color-border);
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sb-profil-head { display: flex; align-items: center; gap: 10px; padding: 2px 4px 4px; }
.sb-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #F58220, #f6a94d);
    display: flex; align-items: center; justify-content: center;
    font-size: 17px; flex: none;
}
.sb-profil-role { font-size: 13px; font-weight: 700; line-height: 1.2; }
.sb-profil-sub  { font-size: 11px; color: var(--color-muted); }

/* ── État replié (rail d'icônes) ──────────────────────────────────────────── */
html.sb-collapsed body:has(#app-sidebar) { padding-left: 82px; }
html.sb-collapsed .sidebar { width: 66px; padding: 18px 10px; }
html.sb-collapsed .sidebar-head { justify-content: center; padding-bottom: 16px; }
html.sb-collapsed .sidebar-logo { flex: none; padding: 0; }
html.sb-collapsed .logo-full { display: none; }
html.sb-collapsed .logo-mark { display: none; }   /* le toggle occupe la place */
html.sb-collapsed .sb-lbl,
html.sb-collapsed .sb-profil-meta { display: none; }
html.sb-collapsed .sidebar-link,
html.sb-collapsed .sidebar-action { justify-content: center; gap: 0; padding-left: 0; padding-right: 0; }
html.sb-collapsed .sidebar-profil { align-items: center; }
html.sb-collapsed .sb-profil-head { justify-content: center; padding: 2px 0 4px; }
html.sb-collapsed .sb-chevron { transform: scaleX(-1); display: inline-block; }

/* Repli en barre horizontale sur petit écran (la barre l'emporte sur l'état replié) */
@media (max-width: 820px) {
    html.sb-collapsed body:has(#app-sidebar) { padding-left: 24px; }
    html.sb-collapsed .sidebar { width: auto; padding: 10px 14px; }
    html.sb-collapsed .sidebar-head { padding-bottom: 0; }
    html.sb-collapsed .logo-full { display: block; }
    html.sb-collapsed .sb-lbl { display: none; }
    body:has(#app-sidebar) { padding-left: 24px; }
    .sidebar {
        position: static;
        width: auto;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
        padding: 10px 14px;
        overflow-x: auto;
        margin: -24px -32px 20px;   /* compense le padding body pour coller aux bords */
    }
    .sidebar-logo { padding: 0 10px 0 2px; }
    .sidebar-logo svg { max-height: 32px; width: auto; }
    .sidebar-nav { flex-direction: row; }
    .sidebar-footer { margin-top: 0; margin-left: auto; flex-direction: row; align-items: center; gap: 8px; padding-top: 0; }
    .sidebar-profil { flex-direction: row; align-items: center; border-top: none; border-left: 1px solid var(--color-border); padding: 0 0 0 10px; }
    .sb-profil-sub { display: none; }
    .sidebar-action .sb-lbl, .sidebar-link .sb-lbl { display: none; }
}
