:root {
    --bg: #f5f5f5;
    --surface: #ffffff;
    --border: #ddd;
    --text: #1a1a1a;
    --muted: #666;
    --accent: #2563eb;
    --armed: #dc2626;
    --disarmed: #16a34a;
    --unknown: #9ca3af;
    --cat-opening: #2563eb;
    --cat-alarm: #dc2626;
    --cat-trouble: #d97706;
    --cat-bypass: #7c3aed;
    --cat-test: #6b7280;
    --cat-medical: #ec4899;
    --cat-fire: #f97316;
    --cat-panic: #dc2626;
    --cat-intrusion: #b91c1c;
    --cat-access: #8b5cf6;
    --cat-system: #475569;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

/* Nav */
header { background: var(--surface); border-bottom: 1px solid var(--border); }
nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    height: 52px;
}
.nav-brand { font-weight: 600; font-size: 15px; text-decoration: none; color: var(--text); }
.nav-links { display: flex; gap: 1rem; }
.nav-links a { text-decoration: none; color: var(--muted); padding: 4px 8px; border-radius: 4px; }
.nav-links a:hover, .nav-links a.active { color: var(--accent); background: #eff6ff; }

/* Layout */
main { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 20px; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; }
.back-link { display: inline-block; color: var(--muted); text-decoration: none; margin-bottom: 0.25rem; font-size: 13px; }
.back-link:hover { color: var(--accent); }

/* Table */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    background: #f9f9f9;
    border-bottom: 1px solid var(--border);
}
.table td { padding: 10px 14px; border-bottom: 1px solid #f0f0f0; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fafafa; }
.table tr.inactive td { opacity: 0.5; }

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.badge-armed   { background: #fee2e2; color: var(--armed); }
.badge-disarmed { background: #dcfce7; color: var(--disarmed); }
.badge-unknown { background: #f3f4f6; color: var(--unknown); }

/* Qualifiers */
.qualifier {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-left: 4px;
}
.q-event   { background: #fef9c3; color: #854d0e; }
.q-restore { background: #dcfce7; color: #166534; }

/* Event actions */
.event-action { font-weight: 500; }
.cat-opening   { color: var(--cat-opening); }
.cat-alarm     { color: var(--cat-alarm); }
.cat-trouble   { color: var(--cat-trouble); }
.cat-bypass    { color: var(--cat-bypass); }
.cat-test      { color: var(--cat-test); }
.cat-medical   { color: var(--cat-medical); }
.cat-fire      { color: var(--cat-fire); }
.cat-panic     { color: var(--cat-panic); }
.cat-intrusion { color: var(--cat-intrusion); }
.cat-access    { color: var(--cat-access); }
.cat-system    { color: var(--cat-system); }
.cat-unknown   { color: var(--muted); }

/* Filters */
.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.filter-group { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.filter-group span { color: var(--muted); font-size: 12px; font-weight: 600; }
.filter-btn {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    text-decoration: none;
    color: var(--muted);
    border: 1px solid var(--border);
    transition: all 0.1s;
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.cat-btn-opening.active   { background: var(--cat-opening);   border-color: var(--cat-opening); }
.cat-btn-alarm.active     { background: var(--cat-alarm);     border-color: var(--cat-alarm); }
.cat-btn-trouble.active   { background: var(--cat-trouble);   border-color: var(--cat-trouble); }
.cat-btn-bypass.active    { background: var(--cat-bypass);    border-color: var(--cat-bypass); }
.cat-btn-test.active      { background: var(--cat-test);      border-color: var(--cat-test); }
.cat-btn-medical.active   { background: var(--cat-medical);   border-color: var(--cat-medical); }
.cat-btn-fire.active      { background: var(--cat-fire);      border-color: var(--cat-fire); }
.cat-btn-panic.active     { background: var(--cat-panic);     border-color: var(--cat-panic); }
.cat-btn-intrusion.active { background: var(--cat-intrusion); border-color: var(--cat-intrusion); }
.cat-btn-access.active    { background: var(--cat-access);    border-color: var(--cat-access); }
.cat-btn-system.active    { background: var(--cat-system);    border-color: var(--cat-system); }

/* Live dot */
.live-dot {
    display: inline-block;
    width: 8px; height: 8px;
    background: #16a34a;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Admin layout */
.admin-layout { display: grid; grid-template-columns: 360px 1fr; gap: 1.5rem; align-items: start; }
.config-grid  { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
}
.card h2 { font-size: 15px; font-weight: 600; margin-bottom: 1rem; }
.card-warning { border-color: #fbbf24; background: #fffbeb; }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); }
.hint { font-size: 11px; color: var(--muted); }
input[type=text], input[type=email], input[type=number], select, textarea {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 13px;
    font-family: inherit;
    background: var(--bg);
    width: 100%;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
}
input:disabled { opacity: 0.6; cursor: not-allowed; }
textarea { resize: vertical; }

.inline-form { display: flex; gap: 0.4rem; align-items: center; margin-top: 0.75rem; flex-wrap: wrap; }
.input-sm { padding: 4px 8px; font-size: 12px; }
.input-num { width: 60px; }
.input-grow { flex: 1; min-width: 100px; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    transition: all 0.1s;
}
.btn:hover { border-color: #999; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: #1d4ed8; }
.btn-muted { color: var(--muted); }
.btn-danger { background: #fee2e2; color: var(--armed); border-color: #fca5a5; }
.btn-danger:hover { background: var(--armed); color: #fff; }
.btn-warning { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.btn-warning:hover { background: #f59e0b; color: #fff; }
.btn-sm { padding: 3px 10px; font-size: 12px; }
.btn-xs { padding: 1px 6px; font-size: 11px; }

/* Flash messages */
.flash {
    padding: 10px 14px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    color: var(--accent);
    margin-bottom: 1rem;
    font-size: 13px;
}

.table-sm td, .table-sm th { padding: 6px 10px; }
.actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* View toggle */
.header-actions { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
.view-toggle { display: flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.view-btn {
    padding: 5px 14px;
    font-size: 13px;
    text-decoration: none;
    color: var(--muted);
    background: var(--surface);
    border: none;
    cursor: pointer;
}
.view-btn:not(:last-child) { border-right: 1px solid var(--border); }
.view-btn.active { background: var(--accent); color: #fff; }
.view-btn:hover:not(.active) { background: #f5f5f5; }

/* Planning */
.planning-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.planning-title { font-weight: 600; font-size: 15px; flex: 1; text-align: center; }

.planning-grid { display: flex; flex-direction: column; gap: 0; }

.planning-axis { display: flex; align-items: center; margin-bottom: 2px; }
.axis-row { position: relative; height: 20px; }
.axis-label {
    position: absolute;
    font-size: 10px;
    color: var(--muted);
    transform: translateX(-50%);
    white-space: nowrap;
}

.planning-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 3px 0;
    border-bottom: 1px solid #f3f4f6;
}
.planning-row:last-child { border-bottom: none; }
.planning-day-label {
    width: 80px;
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    font-family: monospace;
}
.planning-bar-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.planning-bar { display: block; cursor: default; }
.planning-bar rect { transition: opacity 0.1s; }
.planning-bar rect:hover { opacity: 1 !important; }

/* Curseur 'heure courante' sur la barre planning du jour en cours */
.now-cursor     { animation: now-pulse-line 2s ease-in-out infinite; }
.now-cursor-dot { animation: now-pulse-dot  2s ease-in-out infinite; }
@keyframes now-pulse-line {
    0%, 100% { opacity: 0.6; }
    50%      { opacity: 1; }
}
@keyframes now-pulse-dot {
    0%, 100% { opacity: 0.7; }
    50%      { opacity: 1; }
}

.planning-summary {
    display: block;
    min-height: 16px;
    line-height: 1.6;
}
/* Phrase descriptive (style #3 retenu — phrase naturelle) */
.narrative-text {
    font-size: 13.5px;
    color: #1e293b;
    line-height: 1.55;
}
.narrative-text .bad {
    color: #dc2626;
    font-weight: 700;
}
.narrative-text.muted {
    color: #94a3b8;
    font-style: italic;
}
/* Ligne anomalies sous la phrase descriptive */
.narrative-anomalies {
    margin-top: 4px;
    padding: 3px 10px;
    background: #fffbeb;
    color: #92400e;
    border-left: 3px solid #f59e0b;
    border-radius: 0 4px 4px 0;
    font-size: 12.5px;
    line-height: 1.4;
    display: inline-block;
}

.planning-legend {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 12px;
    color: var(--muted);
}
.legend-item { display: flex; align-items: center; gap: 4px; }
.legend-dot {
    width: 12px; height: 12px;
    border-radius: 2px;
    display: inline-block;
}
.legend-dot.open    { background: #22c55e; }
.legend-dot.closed  { background: #d1d5db; }
.legend-dot.unknown { background: #f3f4f6; border: 1px solid #d1d5db; }
.holiday-dot { font-size: 11px; cursor: help; margin-left: 2px; }

.legend-line {
    width: 20px; height: 2px;
    background: repeating-linear-gradient(90deg, #f59e0b 0 3px, transparent 3px 6px);
    display: inline-block;
}

/* Prefs panel */
.prefs-panel {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.prefs-panel h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.prefs-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.prefs-label { font-size: 12px; font-weight: 600; color: var(--muted); min-width: 220px; }
.pref-check {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    cursor: pointer;
}
.prefs-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.5rem; }

/* Anomalies */
.row-anomaly td { background: #fff7ed; }
.row-anomaly:hover td { background: #ffedd5 !important; }
.badge-anomaly {
    color: #d97706;
    font-size: 11px;
    margin-left: 4px;
    cursor: help;
}
.card-hours { grid-column: 1 / -1; }

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: center;
    padding: 1rem;
    color: var(--muted);
}
.pagination a { color: var(--accent); text-decoration: none; }

/* Misc */
.count { font-size: 14px; font-weight: 400; color: var(--muted); }
.mono  { font-family: monospace; font-size: 13px; }
.small { font-size: 12px; }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 2rem; text-align: center; }

/* ─────────────────────────────────────────────────────────────────
   Layout avec sidebar admin (Phase A étape 1, 2026-04-25)
   La sidebar est visible uniquement sur les pages /admin/* et /config
   ───────────────────────────────────────────────────────────────── */
nav { justify-content: space-between; }
nav .nav-links { flex: 1; }

.nav-user-role {
    font-size: 10px; padding: 2px 6px; border-radius: 3px;
    background: #fef3c7; color: #92400e; text-transform: uppercase;
    letter-spacing: .04em; font-weight: 500;
}
.nav-user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--accent); color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px;
}

/* User menu dropdown */
.user-menu { position: relative; }
.user-menu-trigger {
    background: transparent; border: 0; padding: 0; cursor: pointer;
    border-radius: 50%; transition: box-shadow .15s;
}
.user-menu-trigger:hover { box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.user-menu-trigger:focus { outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,.3); }

.user-menu-dropdown {
    position: absolute; top: calc(100% + 8px); right: 0;
    background: white; border: 1px solid var(--border); border-radius: 8px;
    box-shadow: 0 10px 30px rgba(15,23,42,.15);
    min-width: 240px; padding: 6px 0;
    display: none; z-index: 100;
}
.user-menu-dropdown.open { display: block; }
.user-menu-header {
    padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.user-menu-name { font-weight: 600; font-size: 14px; color: var(--text); }
.user-menu-email { font-size: 12px; color: var(--muted); margin-top: 2px; }
.user-menu-meta { margin-top: 6px; font-size: 11px; color: var(--muted); }
.user-menu-item {
    display: block; padding: 9px 16px; font-size: 13px; color: var(--text);
    text-decoration: none; transition: background .12s;
}
.user-menu-item:hover { background: var(--bg); }
.user-menu-logout { color: var(--armed); border-top: 1px solid var(--border); margin-top: 4px; padding-top: 10px; }
.user-menu-logout:hover { background: #fef2f2; }

/* Onglets génériques (settings, audit, planning, etc.) */
.settings-tabs {
    display: flex; border-bottom: 1px solid var(--border);
    margin-top: 4px;
}
.settings-tabs a {
    padding: 10px 16px; border-bottom: 2px solid transparent;
    color: var(--muted); text-decoration: none; font-size: 13px;
}
.settings-tabs a.active {
    border-bottom-color: var(--accent); color: var(--accent); font-weight: 500;
}
.settings-tabs a:hover { color: var(--text); }

/* Toasts (notifications discrètes en bas à droite) */
.toast-container {
    position: fixed; bottom: 24px; right: 24px; z-index: 2000;
    display: flex; flex-direction: column; gap: 8px;
    pointer-events: none;
}
.toast {
    background: #1e293b; color: white;
    padding: 12px 18px; border-radius: 6px; font-size: 13px;
    box-shadow: 0 10px 30px rgba(0,0,0,.25);
    max-width: 380px; pointer-events: auto;
    transform: translateY(20px); opacity: 0;
    transition: transform .25s ease-out, opacity .25s ease-out;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast-error { background: #991b1b; }
.toast-success { background: #166534; }
.toast-warn { background: #92400e; }

/* Breadcrumbs (fil d'ariane sur pages profondes) */
.breadcrumb {
    font-size: 12px; color: var(--muted); margin-bottom: 6px;
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.breadcrumb a {
    color: var(--muted); text-decoration: none;
}
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: #d1d5db; }
.breadcrumb .current { color: var(--text); font-weight: 500; }

/* ─────────────────────────────────────────────────────────────────
   Mode dense (toggle dans /admin/owner-settings)
   Réduit padding, taille de police et hauteur de ligne pour afficher
   plus d'info à l'écran. Idéal quand on a 200+ sites.
   ───────────────────────────────────────────────────────────────── */
body.dense                  { font-size: 13px; }
body.dense main             { padding: 1rem; }
body.dense .main-with-sidebar { padding: 1rem 1.25rem; }
body.dense .page-header     { margin-bottom: 12px; }
body.dense .page-header h1  { font-size: 17px; }
body.dense .card            { padding: 12px; }
body.dense .card h2         { font-size: 14px; }
body.dense .table th        { padding: 6px 8px; font-size: 11px; }
body.dense .table td        { padding: 6px 8px; }
body.dense nav              { height: 44px; }
body.dense .sidebar         { padding: 8px 0; }
body.dense .sidebar a       { padding: 5px 18px; font-size: 13px; }
body.dense .sidebar-group   { padding: 8px 18px 4px; }
body.dense .badge           { padding: 1px 6px; font-size: 10px; }
body.dense .stat-box        { padding: 10px 12px; }
body.dense .stat-box .val   { font-size: 18px; }

.layout-with-sidebar {
    display: grid; grid-template-columns: 220px 1fr;
    min-height: calc(100vh - 53px);
}

.sidebar {
    background: var(--surface); border-right: 1px solid var(--border);
    padding: 12px 0;
}
.sidebar-group {
    font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--muted); padding: 12px 18px 6px;
}
.sidebar a {
    display: block; padding: 8px 18px; color: var(--muted);
    text-decoration: none; font-size: 14px;
    border-left: 3px solid transparent;
}
.sidebar a:hover { background: var(--bg); color: var(--text); }
.sidebar a.active {
    background: #eff6ff; color: var(--accent);
    border-left-color: var(--accent); font-weight: 500;
}

.main-with-sidebar {
    padding: 1.5rem 2rem;
    max-width: none;     /* override le max-width:1200px du main par défaut */
    margin: 0;           /* override le margin:0 auto qui centrerait l'élément */
    width: auto;         /* prend toute la largeur du grid item (1fr) */
    min-width: 0;        /* évite que le contenu force une min-width via grid */
}

/* Mobile : sidebar passe sur le côté en accordéon (V1 minimal — collapse) */
@media (max-width: 768px) {
    .layout-with-sidebar { grid-template-columns: 1fr; }
    .sidebar {
        display: flex; flex-wrap: wrap; padding: 8px;
        border-right: none; border-bottom: 1px solid var(--border);
    }
    .sidebar-group { width: 100%; padding: 4px 8px; }
    .sidebar a { border-left: 0; padding: 6px 12px; border-radius: 4px; }
    .sidebar a.active { border-left: 0; }
}

/* ─────────────────────────────────────────────────────────────────
   Quick search Cmd+K (2026-04-25)
   ───────────────────────────────────────────────────────────────── */
.nav-search-btn {
    display: flex; align-items: center; gap: 6px;
    background: var(--bg); border: 1px solid var(--border);
    padding: 5px 10px; border-radius: 6px;
    color: var(--muted); font-size: 13px; cursor: pointer;
    transition: all .15s;
}
.nav-search-btn:hover { border-color: var(--accent); color: var(--accent); }
.nav-search-btn span { font-size: 12px; }
.nav-search-btn kbd {
    background: white; border: 1px solid var(--border); border-radius: 3px;
    padding: 1px 5px; font-size: 10px; font-family: monospace; color: var(--muted);
}
@media (max-width: 768px) {
    .nav-search-btn span, .nav-search-btn kbd { display: none; }
}

.qs-overlay {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .55);
    display: none; align-items: flex-start; justify-content: center;
    z-index: 1000; padding-top: 10vh;
    animation: qs-fade .12s ease-out;
}
.qs-overlay.open { display: flex; }
@keyframes qs-fade { from { opacity: 0 } to { opacity: 1 } }

.qs-modal {
    background: white; border-radius: 10px; width: 92%; max-width: 600px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
    overflow: hidden; display: flex; flex-direction: column;
    max-height: 70vh;
}
.qs-input-wrap {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.qs-icon { font-size: 18px; color: var(--muted); }
#qs-input {
    flex: 1; border: 0; outline: none; font-size: 16px; color: var(--text);
    background: transparent;
}
.qs-esc {
    background: var(--bg); border: 1px solid var(--border); border-radius: 3px;
    padding: 2px 6px; font-size: 11px; font-family: monospace; color: var(--muted);
}
.qs-results {
    flex: 1; overflow-y: auto; padding: 6px 0;
}
.qs-hint { padding: 24px; text-align: center; color: var(--muted); font-size: 13px; }

.qs-item {
    display: block; padding: 10px 16px; text-decoration: none; color: var(--text);
    border-left: 3px solid transparent; cursor: pointer;
}
.qs-item:hover, .qs-item.active {
    background: #eff6ff; border-left-color: var(--accent);
}
.qs-item-main { display: flex; justify-content: space-between; align-items: baseline; }
.qs-item-label { font-weight: 500; font-size: 14px; }
.qs-item-acc {
    font-family: monospace; font-size: 11px; color: var(--muted);
    background: var(--bg); padding: 2px 6px; border-radius: 3px;
}
.qs-item-meta { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; gap: 10px; align-items: center; }
.qs-region {
    background: #ede9fe; color: #5b21b6; padding: 1px 6px; border-radius: 3px;
    font-size: 10px;
}

/* ─────────────────────────────────────────────────────────────────
   Mode intervention (mute par site)
   ───────────────────────────────────────────────────────────────── */
.mute-banner {
    display: flex; align-items: center; gap: 10px;
    background: #fef3c7; border: 1px solid #fbbf24; border-radius: 6px;
    padding: 10px 14px; margin: 0 0 16px 0;
    font-size: 13px; color: #78350f;
}
.mute-banner strong { color: #92400e; }

.mute-pill {
    background: #fef3c7; color: #92400e;
    margin-left: 8px; font-size: 10px; padding: 2px 8px;
}

dialog.mute-modal {
    border: 0; border-radius: 10px; padding: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .25); max-width: 460px; width: 90%;
}
dialog.mute-modal::backdrop { background: rgba(15, 23, 42, .55); }
dialog.mute-modal h3 { font-size: 16px; }
dialog.mute-modal .field { margin-bottom: 12px; }
dialog.mute-modal .field label { display: block; font-size: 12px; font-weight: 500; color: var(--text); margin-bottom: 4px; }
dialog.mute-modal select,
dialog.mute-modal input[type="text"] {
    width: 100%; padding: 8px 10px; border: 1px solid var(--border);
    border-radius: 5px; font-size: 14px;
}

/* ─────────────────────────────────────────────────────────────────
   Heatmap d'activité (style GitHub contributions)
   ───────────────────────────────────────────────────────────────── */
.heatmap-section {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 8px; padding: 16px; margin: 16px 0;
}
.heatmap-header {
    display: flex; align-items: baseline; justify-content: space-between;
    margin-bottom: 12px; flex-wrap: wrap; gap: 8px;
}
.heatmap-header h3 { font-size: 14px; color: var(--text); }

.heatmap-grid {
    display: flex; flex-direction: column; gap: 3px;
    overflow-x: auto;
}
.heatmap-row { display: flex; gap: 3px; align-items: center; }
.heatmap-axis { margin-bottom: 4px; }
.heatmap-day-label {
    width: 36px; flex-shrink: 0; font-size: 11px;
    color: var(--muted); text-align: right; padding-right: 8px;
}
.heatmap-hour-label {
    flex: 1; min-width: 22px; font-size: 9px; color: var(--muted);
    text-align: center; font-family: monospace;
}
.heatmap-cell {
    flex: 1; min-width: 22px; height: 22px;
    background: #f3f4f6; border-radius: 2px;
    cursor: default; transition: transform .1s;
}
.heatmap-cell:hover { transform: scale(1.2); z-index: 10; box-shadow: 0 0 0 1px var(--accent); }

.heatmap-legend {
    display: flex; align-items: center; gap: 4px;
    margin-top: 12px; padding-top: 12px; border-top: 1px solid #f0f0f0;
}
.heatmap-legend .heatmap-cell {
    width: 14px; height: 14px; min-width: 14px; flex: 0 0 auto;
}

/* ─────────────────────────────────────────────────────────────────
   Login page
   ───────────────────────────────────────────────────────────────── */
.login-body { background: linear-gradient(135deg, #1e293b 0%, #334155 100%); min-height: 100vh; }
.login-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 20px;
}
.login-box {
    background: white; padding: 40px; border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3); width: 100%; max-width: 400px;
}
.login-box h1 { font-size: 22px; margin-bottom: 6px; color: #0f172a; }
.login-subtitle { font-size: 13px; color: var(--muted); margin-bottom: 24px; }
.login-msg {
    background: #fef3c7; border: 1px solid #fbbf24; border-radius: 4px;
    padding: 8px 12px; font-size: 13px; color: #78350f; margin-bottom: 14px;
}
.login-box .field { margin-bottom: 14px; }
.login-box .field label {
    display: block; font-size: 12px; font-weight: 500; color: var(--muted);
    margin-bottom: 4px;
}
.login-box .field input {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border);
    border-radius: 6px; font-size: 14px;
}
.login-box .field input:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}
.login-remember {
    display: flex; align-items: center; gap: 8px; font-size: 13px;
    color: var(--muted); margin-bottom: 18px;
}
.login-btn { width: 100%; padding: 10px; }
.login-footer {
    font-size: 11px; color: var(--muted); text-align: center; margin-top: 24px;
    line-height: 1.5;
}

/* ─────────────────────────────────────────────────────────────────
   Bandeau impersonation
   ───────────────────────────────────────────────────────────────── */
.impersonation-banner {
    display: flex; align-items: center; gap: 12px;
    background: #fef3c7; border-bottom: 2px solid #f59e0b;
    padding: 8px 16px; font-size: 13px; color: #78350f;
}
.impersonation-banner strong { color: #92400e; }
.impersonation-banner form { display: inline; }

/* ─────────────────────────────────────────────────────────────────
   Stats grid (vues parc admin/regional/enseigne)
   ───────────────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.stat-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}
.stat-box .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.stat-box .val { font-size: 26px; font-weight: 700; color: #0f172a; line-height: 1; }
.stat-box .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat-box.alert .val { color: #dc2626; }
.stat-box.warn  .val { color: #d97706; }
.stat-box.ok    .val { color: #16a34a; }

/* ─────────────────────────────────────────────────────────────────
   Filtres pills (parc, users, etc.)
   ───────────────────────────────────────────────────────────────── */
.filter-pill {
    padding: 4px 10px; border-radius: 999px; font-size: 12px;
    background: #f1f5f9; color: #475569; cursor: pointer;
    text-decoration: none; border: 0; display: inline-block;
    transition: background .12s, color .12s;
}
.filter-pill:hover:not(.active) { background: #e2e8f0; }
.filter-pill.active { background: var(--accent); color: white; }

/* Champ de recherche dans une barre filtre */
input.search {
    padding: 6px 12px; border: 1px solid var(--border);
    border-radius: 6px; font-size: 13px; min-width: 220px;
    background: white;
}
input.search:focus { outline: none; border-color: var(--accent); }

/* ─────────────────────────────────────────────────────────────────
   Badge région (uniformiser le rendu purple)
   ───────────────────────────────────────────────────────────────── */
.badge-region {
    background: #ede9fe; color: #5b21b6;
    font-size: 10px; padding: 2px 8px; border-radius: 999px;
    font-weight: 500; display: inline-block;
}

/* ─────────────────────────────────────────────────────────────────
   Avatars utilisateurs colorés par rôle (liste users)
   ───────────────────────────────────────────────────────────────── */
.user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--accent); color: white;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px; flex-shrink: 0;
}
.user-avatar.role-owner    { background: #0f172a; }
.user-avatar.role-admin    { background: #3b82f6; }
.user-avatar.role-regional { background: #16a34a; }
.user-avatar.role-enseigne { background: #ea580c; }
.user-avatar.role-site     { background: #6366f1; }
.user-avatar.role-client   { background: #6366f1; }

.user-row { display: flex; gap: 10px; align-items: center; }
.user-row-name { font-weight: 600; }
.user-row-meta { font-size: 11px; color: var(--muted); }

/* Badge rôle (couleur de fond pâle, texte foncé) */
.badge-role-owner    { background: #cbd5e1; color: #0f172a; }
.badge-role-admin    { background: #dbeafe; color: #1e40af; }
.badge-role-regional { background: #dcfce7; color: #166534; }
.badge-role-enseigne { background: #ffedd5; color: #9a3412; }
.badge-role-site     { background: #e0e7ff; color: #3730a3; }
.badge-role-client   { background: #e0e7ff; color: #3730a3; }

/* ─────────────────────────────────────────────────────────────────
   Radio cards (sélection rôle dans formulaire utilisateur)
   ───────────────────────────────────────────────────────────────── */
.role-cards {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
}
.role-card {
    border: 2px solid var(--border); padding: 14px 10px;
    border-radius: 8px; cursor: pointer; text-align: center;
    background: white; transition: border-color .12s, background .12s;
}
.role-card input { display: none; }
.role-card:hover { border-color: #94a3b8; }
.role-card-icon { font-size: 24px; line-height: 1; }
.role-card-name { display: block; font-weight: 700; font-size: 13px; margin-top: 6px; color: var(--text); }
.role-card-hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
.role-card:has(input:checked) {
    border-color: var(--accent); background: #eff6ff;
}

/* ─────────────────────────────────────────────────────────────────
   Help panel (panneau d'aide à droite — formulaire utilisateur)
   ───────────────────────────────────────────────────────────────── */
.help-panel {
    background: #fafbfc; border: 1px dashed #cbd5e1; border-radius: 8px;
    padding: 16px;
}
.help-panel h2 { font-size: 13px; margin-bottom: 8px; }
.help-panel p, .help-panel li { font-size: 12px; color: #475569; line-height: 1.6; }
.help-panel ul { padding-left: 20px; line-height: 1.7; margin-top: 6px; }
.help-panel .can-not { color: var(--muted); margin-top: 12px; }
.help-panel .can-not + ul li { color: var(--muted); }

/* Layout 2 colonnes pour le formulaire utilisateur */
.form-with-aside {
    display: grid; grid-template-columns: 1fr 320px; gap: 20px;
    align-items: start;
}
@media (max-width: 900px) {
    .form-with-aside { grid-template-columns: 1fr; }
}

/* ─────────────────────────────────────────────────────────────────
   Card "Région" (vue parc enseigne : une card par région)
   ───────────────────────────────────────────────────────────────── */
.region-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 8px; padding: 0;
    margin-bottom: 12px; overflow: hidden;
}
.region-card-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 14px; border-bottom: 1px solid var(--border);
    background: #f8fafc;
}
.region-card-title { font-weight: 600; font-size: 14px; color: var(--text); }
.region-card-meta { font-size: 12px; color: var(--muted); }
.region-card-meta .ok { color: #16a34a; font-weight: 500; }
.region-card-meta .warn { color: #d97706; font-weight: 500; }
.region-card-meta .alert { color: #dc2626; font-weight: 500; }
.region-card table {
    margin: 0;
    table-layout: fixed;   /* largeurs imposées par colgroup, identiques entre cards */
    width: 100%;
}
.region-card table th, .region-card table td {
    padding: 8px 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;   /* évite que un texte long pousse la colonne */
}
/* Permet le wrap dans la cellule "dernier event" qui contient 2 lignes */
.region-card table td.event-cell { white-space: normal; }

/* ─────────────────────────────────────────────────────────────────
   Carte avec en-tête (titre + recherche dans le header)
   Utilisée dans la vue régionale pour la liste des sites
   ───────────────────────────────────────────────────────────────── */
.card-with-header { padding: 0; overflow: hidden; }
.card-with-header > .ch-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 16px; border-bottom: 1px solid var(--border);
}
.card-with-header > .ch-header h2 { font-size: 14px; margin: 0; }
.card-with-header table { margin: 0; }

/* ─────────────────────────────────────────────────────────────────
   Card cliquable (lignes "à configurer" surlignées) + texte de config
   ───────────────────────────────────────────────────────────────── */
.row-needs-config td { background: #fef9c3; }
.row-needs-config:hover td { background: #fef08a !important; }
.config-status-ok    { color: #16a34a; font-size: 12px; }
.config-status-warn  { color: #d97706; font-size: 12px; }
.config-status-error { color: #dc2626; font-size: 12px; }

/* ─────────────────────────────────────────────────────────────────
   Notice de bas de page (restriction périmètre, conventions de rôles)
   ───────────────────────────────────────────────────────────────── */
.page-notice {
    font-size: 12px; color: var(--muted); margin-top: 16px;
    text-align: center;
}
.page-notice.left { text-align: left; }

