body {
    background: #111318;
    color: #e8e8e8;
    font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.page-content {
    flex: 1;
    padding: 20px 24px 40px;
}

/* ============================================================
   Header
   ============================================================ */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: #1b1e26;
    border-bottom: 1px solid #2a2e3a;
    position: sticky;
    top: 0;
    z-index: 10;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
}
.brand-mark {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    width: 28px;
    height: 22px;
    padding: 4px;
    background: #23262f;
    border-radius: 6px;
    flex-shrink: 0;
}
.brand-bar {
    width: 4px;
    border-radius: 1px;
    background: #3d6bff;
}
.brand-bar:nth-child(1) { height: 6px; }
.brand-bar:nth-child(2) { height: 10px; }
.brand-bar:nth-child(3) { height: 14px; }
.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.brand-name {
    font-size: 15px;
    font-weight: 700;
    color: #e8e8e8;
}
.brand-tagline {
    font-size: 11px;
    color: #6b7185;
}
.site-nav {
    display: flex;
    gap: 4px;
}
.nav-link {
    font-size: 13px;
    font-weight: 600;
    color: #9aa1b1;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}
.nav-link:hover {
    background: #23262f;
    color: #e8e8e8;
}
.nav-link.active {
    background: rgba(61, 107, 255, 0.15);
    color: #6f92ff;
}
.tz-select {
    background: #0f1116;
    border: 1px solid #333748;
    color: #e8e8e8;
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 12px;
    margin-left: 6px;
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
    padding: 16px 24px;
    border-top: 1px solid #2a2e3a;
    color: #6b7185;
    font-size: 12px;
    text-align: center;
}
.footer-brand {
    color: #9aa1b1;
    font-weight: 600;
}
.footer-sep {
    margin: 0 6px;
    color: #3a3f4d;
}
h2 {
    margin: 0 0 12px;
    font-weight: 600;
}
.back-link {
    color: #9aa1b1;
    font-size: 13px;
    text-decoration: none;
}
.back-link:hover {
    color: #e8e8e8;
}
.controls {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    background: #1b1e26;
    border: 1px solid #2a2e3a;
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 16px;
}
.controls label {
    display: flex;
    flex-direction: column;
    font-size: 12px;
    color: #9aa1b1;
    gap: 4px;
}
.controls input[type="datetime-local"],
.controls select {
    background: #0f1116;
    border: 1px solid #333748;
    color: #e8e8e8;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 13px;
}
.controls button {
    background: #3d6bff;
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}
.controls button.secondary {
    background: #2a2e3a;
    color: #cfd3dc;
}
.controls button:hover {
    opacity: 0.9;
}
.status {
    font-size: 12px;
    color: #9aa1b1;
    margin-left: 8px;
}
#rf-plot {
    background: #111318;
    min-height: 700px;
}
.divider {
    border: none;
    border-top: 1px solid #2a2e3a;
    margin: 32px 0 20px;
}
#temp-plot {
    background: #111318;
    min-height: 400px;
}
.freq-panel {
    margin-top: 18px;
    background: #1b1e26;
    border: 1px solid #2a2e3a;
    border-radius: 8px;
    padding: 14px 18px;
}
.freq-panel h3 {
    margin: 0 0 10px;
    font-size: 14px;
    color: #9aa1b1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
ul.freq-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 8px 20px;
}
.freq-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    padding: 6px 8px;
    border-bottom: 1px solid #23262f;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.15s ease;
}
.freq-item:hover {
    background: #23262f;
}
.freq-item.active {
    background: #262b3d;
    box-shadow: inset 3px 0 0 #3d6bff;
}
.swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}
.freq-label {
    font-weight: 600;
    min-width: 70px;
}
.freq-channels {
    color: #b8bdc9;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.freq-count {
    color: #6b7185;
    font-size: 11px;
    flex-shrink: 0;
}

/* ============================================================
   Page d'accueil : masthead, bandeau d'instruments, cartes de sites
   ============================================================ */
.home-header {
    margin-bottom: 20px;
}
.eyebrow {
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b7185;
    margin: 0 0 6px;
}
.home-intro {
    color: #9aa1b1;
    font-size: 13.5px;
    margin: 0 0 10px;
    max-width: 62ch;
}
.home-subtitle {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 6px 0 0;
    flex-wrap: wrap;
}
.home-meta {
    font-size: 12px;
    color: #6b7185;
}
.pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.pill-online {
    background: rgba(52, 199, 89, 0.15);
    color: #34c759;
}
.pill-mixed {
    background: rgba(255, 159, 10, 0.15);
    color: #ff9f0a;
}

/* Bandeau d'instruments : compteurs par catégorie avant la grille */
.instrument-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1px;
    background: #2a2e3a;
    border: 1px solid #2a2e3a;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 24px;
}
.instrument {
    background: #1b1e26;
    padding: 12px 16px;
}
.instrument-label {
    display: block;
    font-size: 12px;
    color: #9aa1b1;
    margin-bottom: 4px;
}
.instrument-value {
    display: block;
    font-family: "SF Mono", Consolas, monospace;
    font-size: 22px;
    font-weight: 600;
}
.instrument-total .instrument-value { color: #e8e8e8; }
.instrument-online .instrument-value { color: #34c759; }
.instrument-offline-recent .instrument-value { color: #ff9f0a; }
.instrument-offline-long .instrument-value { color: #ff4d4f; }

.empty-state {
    background: #1b1e26;
    border: 1px solid #2a2e3a;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    color: #9aa1b1;
}

/* Carte des sites (Leaflet) */
.map-panel {
    background: #1b1e26;
    border: 1px solid #2a2e3a;
    border-radius: 8px;
    padding: 14px 18px 18px;
    margin-bottom: 24px;
}
.map-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}
.map-panel-title {
    margin: 0;
    font-size: 14px;
    color: #9aa1b1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.map-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.map-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #9aa1b1;
}
.map-legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dot-online { background: #34c759; }
.dot-offline-recent { background: #ff9f0a; }
.dot-offline-long { background: #ff4d4f; }
#site-map {
    height: 420px;
    border-radius: 8px;
    overflow: hidden;
    background: #1b1e26;
    border: 1px solid #2a2e3a;
}

/* Titres de section (En ligne / Hors ligne < 5 j / Hors ligne > 5 j) */
.section-title {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #9aa1b1;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 32px 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid #2a2e3a;
}
.section-title::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 2px;
}
.section-title-online::before { background: #34c759; }
.section-title-offline-recent::before { background: #ff9f0a; }
.section-title-offline-long::before { background: #ff4d4f; }

.site-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}
.site-card {
    background: #1b1e26;
    border: 1px solid #2a2e3a;
    border-left: 3px solid #3a3f4d;
    border-radius: 10px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.site-card.card-online {
    border-left-color: #34c759;
}
.site-card.card-offline-recent {
    border-left-color: #ff9f0a;
}
.site-card.card-offline {
    border-left-color: #ff4d4f;
}
.site-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.site-name {
    font-size: 16px;
    font-weight: 700;
    text-transform: capitalize;
}
.status-pill {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    letter-spacing: 0.02em;
}
.status-online {
    background: rgba(52, 199, 89, 0.15);
    color: #34c759;
}
.status-offline-recent {
    background: rgba(255, 159, 10, 0.15);
    color: #ff9f0a;
}
.status-offline {
    background: rgba(255, 77, 79, 0.15);
    color: #ff4d4f;
}

/* Barres de signal : indicateur de statut alternatif aux points colorés */
.signal-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 14px;
}
.signal-bar {
    width: 4px;
    border-radius: 1px;
    background: #3a3f4d;
}
.signal-bar:nth-child(1) { height: 5px; }
.signal-bar:nth-child(2) { height: 8px; }
.signal-bar:nth-child(3) { height: 11px; }
.signal-bar:nth-child(4) { height: 14px; }
.signal-bars-online .signal-bar.lit { background: #34c759; }
.signal-bars-offline-recent .signal-bar.lit { background: #ff9f0a; }
.signal-bars-offline-long .signal-bar.lit { background: #ff4d4f; }

.site-error {
    font-size: 12px;
    color: #ff9f0a;
    background: rgba(255, 159, 10, 0.08);
    border-radius: 6px;
    padding: 8px 10px;
}
.site-stats {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}
.stat-label {
    color: #9aa1b1;
}
.stat-value {
    font-weight: 600;
    color: #e8e8e8;
}
.stat-mono {
    font-family: "SF Mono", Consolas, monospace;
    font-size: 12px;
    font-weight: 400;
    color: #b8bdc9;
}
.measurement-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.badge {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 5px;
    border: 1px solid #2a2e3a;
}
.badge-active {
    color: #cfd3dc;
    background: #23262f;
}
.badge-inactive {
    color: #4a4f5c;
    background: transparent;
    border-style: dashed;
}
.consult-btn {
    align-self: flex-start;
    margin-top: 4px;
    background: #3d6bff;
    color: white;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: 6px;
}
.consult-btn:hover {
    opacity: 0.9;
}

/* ============================================================
   Lien d'accès terminal, éditable par site
   ============================================================ */
.terminal-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.terminal-btn {
    background: #23262f;
    margin-top: 0;
}
.terminal-empty {
    font-size: 12px;
    color: #6b7185;
}
.icon-btn {
    background: #1b1e26;
    border: 1px solid #2a2e3a;
    color: #9aa1b1;
    border-radius: 6px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.icon-btn:hover {
    color: #e8e8e8;
    border-color: #3d6bff;
}
.terminal-edit-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    width: 100%;
    background: #1b1e26;
    border: 1px solid #2a2e3a;
    border-radius: 8px;
    padding: 10px 12px;
}
.terminal-edit-form input[type="url"] {
    background: #0f1116;
    border: 1px solid #333748;
    color: #e8e8e8;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 13px;
    min-width: 280px;
    flex: 1;
}

/* ============================================================
   Connexion / rôle utilisateur
   ============================================================ */
.user-info {
    font-size: 12px;
    color: #9aa1b1;
    margin-left: 10px;
}
.admin-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #6f92ff;
    background: rgba(61, 107, 255, 0.15);
    padding: 2px 6px;
    border-radius: 999px;
}
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-card {
    background: #1b1e26;
    border: 1px solid #2a2e3a;
    border-radius: 10px;
    padding: 32px 28px;
    width: 100%;
    max-width: 360px;
}
.login-brand {
    justify-content: center;
    margin-bottom: 24px;
}
.login-error {
    margin-bottom: 16px;
}
.login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.login-form label {
    display: flex;
    flex-direction: column;
    font-size: 12px;
    color: #9aa1b1;
    gap: 6px;
}
.login-form input {
    background: #0f1116;
    border: 1px solid #333748;
    color: #e8e8e8;
    border-radius: 6px;
    padding: 9px 10px;
    font-size: 14px;
}
.login-form button {
    background: #3d6bff;
    border: none;
    color: white;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    margin-top: 6px;
}
.login-form button:hover {
    opacity: 0.9;
}

/* ============================================================
   Quick Check : petit graphique par sonde, en grille
   ============================================================ */
.quick-error {
    max-width: 640px;
    margin-bottom: 16px;
}
.quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 16px;
}
.quick-card {
    background: #1b1e26;
    border: 1px solid #2a2e3a;
    border-radius: 8px;
    padding: 14px 16px 6px;
}
.quick-card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
}
.quick-card-title {
    font-size: 15px;
    font-weight: 700;
    text-transform: capitalize;
}
.quick-card-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}
.quick-card-meta {
    font-size: 11px;
    color: #6b7185;
}
.quick-plot {
    width: 100%;
    min-height: 260px;
}
.quick-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: #6b7185;
    font-size: 13px;
}
.quick-card .consult-btn {
    margin: 10px 0 14px;
}

/* ============================================================
   Journal des déconnexions
   ============================================================ */
.journal-period-switch {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}
.period-btn {
    font-size: 13px;
    color: #9aa1b1;
    text-decoration: none;
    background: #1b1e26;
    border: 1px solid #2a2e3a;
    border-radius: 6px;
    padding: 6px 14px;
}
.period-btn:hover {
    color: #e8e8e8;
}
.period-btn.active {
    background: rgba(61, 107, 255, 0.15);
    border-color: #3d6bff;
    color: #6f92ff;
}
.journal-card {
    background: #1b1e26;
    border: 1px solid #2a2e3a;
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 16px;
}
.journal-card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}
.journal-site-name {
    font-size: 15px;
    font-weight: 700;
    text-transform: capitalize;
}
.journal-summary {
    font-size: 12px;
    color: #9aa1b1;
}
.journal-events {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.journal-event {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
}
.journal-event:nth-child(odd) {
    background: #171a21;
}
.journal-event-ongoing {
    background: rgba(255, 77, 79, 0.08);
}
.journal-event-range {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #cfd3dc;
}
.journal-badge-ongoing {
    color: #ff4d4f;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
}
.journal-event-duration {
    color: #9aa1b1;
    font-weight: 600;
    white-space: nowrap;
}
