/* ============================================================
   TBPC Supervision — mêmes tokens que le portail TBPC
   Palette : slate + rouge TBPC · Manrope + Archivo Black
   ============================================================ */

:root {
    --tbpc-red:        #ef4a4f;
    --tbpc-red-dark:   #c8282e;

    --ink:             #e2e8f0;
    --ink-2:           #cbd5e1;
    --muted:           #94a3b8;
    --muted-2:         #64748b;

    --bg:              #0f172a;
    --surface:         #1e293b;
    --surface-2:       #334155;
    --border:          #334155;
    --border-strong:   #475569;

    --green:           #34d399;
    --amber:           #fbbf24;
    --blue:            #60a5fa;

    --radius:          10px;
    --radius-sm:       6px;
    --shadow-sm:       0 1px 2px rgba(0,0,0,.2);

    --font-sans:       'Manrope', system-ui, -apple-system, sans-serif;
    --font-display:    'Archivo Black', 'Manrope', sans-serif;
    --font-mono:       ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

html, body {
    font-family: var(--font-sans);
    color: var(--ink);
    background: var(--bg);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--tbpc-red); text-decoration: none; }
a:hover { text-decoration: underline; }

.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    display: flex; flex-direction: column;
}
.brand {
    display: flex; align-items: center;
    padding: 0 8px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}
.brand img { height: 26px; width: auto; display: block; }
.brand-name { font-family: var(--font-display); font-size: 16px; letter-spacing: -.5px; }
.brand-sub  { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    color: var(--ink-2); font-weight: 500; font-size: 13px;
    transition: all .15s;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: rgba(239, 74, 79, .15); color: #fca5a5; }
.nav a .icon { width: 16px; height: 16px; flex-shrink: 0; opacity: .8; }
.nav-badge {
    margin-left: auto; display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
    background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 700;
}
.nav-badge.alert { background: var(--tbpc-red-dark); color: #fff; }
.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }

/* ── Main ────────────────────────────────────────────────── */
.main { padding: 32px 40px; max-width: 1280px; }
.page-header {
    display: flex; justify-content: space-between; align-items: flex-end;
    margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--border);
}
.page-title { font-family: var(--font-display); font-size: 22px; letter-spacing: -.5px; }
.page-subtitle { color: var(--muted); font-size: 13px; margin-top: 4px; }
.page-meta { text-align: right; font-size: 12px; color: var(--muted); font-family: var(--font-mono); }

/* ── Bandeau verdict ─────────────────────────────────────── */
.verdict {
    display: flex; align-items: center; gap: 18px;
    background: var(--surface); border: 1px solid var(--border);
    border-left: 4px solid var(--green);
    border-radius: var(--radius); padding: 20px 24px; margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}
.verdict.degrade { border-left-color: var(--amber); }
.verdict.offline { border-left-color: var(--tbpc-red); }
.verdict-dot {
    width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
    background: var(--green); box-shadow: 0 0 0 6px rgba(52, 211, 153, .15);
}
.verdict.degrade .verdict-dot { background: var(--amber); box-shadow: 0 0 0 6px rgba(251, 191, 36, .15); }
.verdict.offline .verdict-dot { background: var(--tbpc-red); box-shadow: 0 0 0 6px rgba(239, 74, 79, .15);
                                animation: battement 1.8s ease-in-out infinite; }
@keyframes battement { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .verdict.offline .verdict-dot { animation: none; } }
.verdict-text h2 { font-family: var(--font-display); font-size: 20px; letter-spacing: -.3px; }
.verdict-text p  { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ── Stats ───────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.stat-value { font-family: var(--font-display); font-size: 28px; line-height: 1; }
.stat-value.green { color: var(--green); }
.stat-value.amber { color: var(--amber); }
.stat-value.red   { color: var(--tbpc-red); }

/* ── Cards ───────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 20px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.card-header h2 { font-family: var(--font-display); font-size: 14px; letter-spacing: -.2px; }
.card-header .compte { font-size: 12px; color: var(--muted); font-family: var(--font-mono); }

/* ── Tableau services ────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left; padding: 10px 20px; font-size: 11px;
    text-transform: uppercase; letter-spacing: 1px; color: var(--muted);
    font-weight: 600; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.table td { padding: 12px 20px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.c-etat { width: 34px; }
.c-nom { font-weight: 600; }
.c-cible { color: var(--muted); font-family: var(--font-mono); font-size: 12px; }
.c-note { color: var(--ink-2); }
.c-ms { text-align: right; font-family: var(--font-mono); font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ── Le rond ─────────────────────────────────────────────── */
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--muted-2); }
.dot-online  { background: var(--green);    box-shadow: 0 0 0 3px rgba(52, 211, 153, .15); }
.dot-degrade { background: var(--amber);    box-shadow: 0 0 0 3px rgba(251, 191, 36, .15); }
.dot-offline { background: var(--tbpc-red); box-shadow: 0 0 0 3px rgba(239, 74, 79, .15); }

/* ── Badges (mêmes règles que le portail) ────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 999px; border: 1px solid transparent;
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-online  { background: rgba(52, 211, 153, .15); color: #34d399; border-color: rgba(52, 211, 153, .35); }
.badge-degrade { background: rgba(251, 191, 36, .15); color: #fbbf24; border-color: rgba(251, 191, 36, .35); }
.badge-offline { background: rgba(239, 74, 79, .15);  color: #fca5a5; border-color: rgba(239, 74, 79, .35); }

/* ── Conteneurs Docker ───────────────────────────────────── */
.pods { display: flex; flex-wrap: wrap; gap: 8px; padding: 18px 20px; }
.pod {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 8px 12px;
    font-size: 12.5px; font-weight: 500;
}
.pod.critique { border-color: var(--border-strong); }
.pod small { color: var(--muted); font-family: var(--font-mono); font-size: 11px; }
.alerte { margin: 0; padding: 12px 20px; background: rgba(239, 74, 79, .1);
          border-bottom: 1px solid var(--border); color: #fca5a5; font-size: 12.5px; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13px; }

:focus-visible { outline: 2px solid var(--tbpc-red); outline-offset: 2px; }

@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .main { padding: 20px; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .c-cible, .c-note { display: none; }
}

/* ════════════════════════════════════════════════════════════
   V1 — Auth, recherche, cartes, vues
   ════════════════════════════════════════════════════════════ */

/* ── Écrans d'authentification ───────────────────────────── */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
    width: 100%; max-width: 360px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 32px 28px; box-shadow: var(--shadow-sm);
}
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-brand img { height: 30px; }
.auth-sub { font-family: var(--font-display); font-size: 12px; letter-spacing: 2px;
            text-transform: uppercase; color: var(--muted); margin-top: 8px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form .field { display: flex; flex-direction: column; gap: 5px; }
.auth-form label { font-size: 11px; text-transform: uppercase; letter-spacing: .8px;
                   color: var(--muted); font-weight: 600; }
.auth-form input {
    padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    background: var(--bg); color: var(--ink); font-family: var(--font-sans); font-size: 14px;
}
.auth-form input:focus { outline: 2px solid var(--tbpc-red); outline-offset: 1px; border-color: var(--tbpc-red); }
.auth-form .btn { margin-top: 6px; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
    background: var(--surface); color: var(--ink); font-family: var(--font-sans);
    font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--tbpc-red-dark); border-color: var(--tbpc-red-dark); color: #fff; }
.btn-primary:hover { background: var(--tbpc-red); border-color: var(--tbpc-red); }
.auth-erreur { background: rgba(239,74,79,.12); border: 1px solid rgba(239,74,79,.35);
               color: #fca5a5; padding: 10px 12px; border-radius: var(--radius-sm);
               font-size: 13px; margin-bottom: 16px; }
.auth-ok { background: rgba(52,211,153,.12); border: 1px solid rgba(52,211,153,.35);
           color: #34d399; padding: 10px 12px; border-radius: var(--radius-sm);
           font-size: 13px; margin-bottom: 16px; text-align: center; }
.auth-note { color: var(--muted); font-size: 13px; margin-bottom: 16px; text-align: center; }
.auth-retour { display: block; text-align: center; margin-top: 16px; font-size: 12px; color: var(--muted); }

/* ── Sidebar : items "bientôt" + agent ───────────────────── */
.nav-soon {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px;
    color: var(--muted-2); font-weight: 500; font-size: 13px; cursor: default;
}
.nav-soon .icon { width: 16px; height: 16px; opacity: .4; }
.nav-soon em { margin-left: auto; font-style: normal; font-size: 10px; text-transform: uppercase;
               letter-spacing: .5px; background: var(--surface-2); color: var(--muted);
               padding: 2px 6px; border-radius: 999px; }
.agent-tag { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.agent-tag strong { color: var(--green); }
.foot-links { margin-top: 8px; font-size: 12px; }
.foot-links a { color: var(--muted); }
.foot-links a:hover { color: var(--tbpc-red); }

/* ── Verdict : stats à droite ────────────────────────────── */
.verdict-stats { margin-left: auto; display: flex; gap: 20px; }
.vs { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; align-items: center; }
.vs b { font-family: var(--font-display); font-size: 22px; line-height: 1.1; }
.vs.online  b { color: var(--green); }
.vs.degrade b { color: var(--amber); }
.vs.offline b { color: var(--tbpc-red); }
@media (max-width: 700px) { .verdict-stats { display: none; } }

/* ── Barre d'outils : recherche + bascule vue ────────────── */
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; }
.search { flex: 1; position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--muted); }
.search input {
    width: 100%; padding: 11px 12px 11px 38px; border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
    font-family: var(--font-sans); font-size: 14px;
}
.search input:focus { outline: 2px solid var(--tbpc-red); outline-offset: 1px; border-color: var(--tbpc-red); }
.vues { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; }
.vue-btn { display: grid; place-items: center; width: 34px; height: 34px; border: 0;
           background: transparent; color: var(--muted); border-radius: 4px; cursor: pointer; }
.vue-btn svg { width: 17px; height: 17px; }
.vue-btn.active { background: var(--surface-2); color: var(--ink); }
.vue-btn:hover { color: var(--ink); }

/* ── Cartes sites ────────────────────────────────────────── */
.cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; padding: 18px 20px; }
.carte { background: var(--bg); border: 1px solid var(--border); border-left: 3px solid var(--muted-2);
         border-radius: var(--radius-sm); overflow: hidden; }
.carte-online  { border-left-color: var(--green); }
.carte-degrade { border-left-color: var(--amber); }
.carte-offline { border-left-color: var(--tbpc-red); }
.carte-head { display: flex; align-items: center; gap: 9px; padding: 13px 15px 10px; }
.carte-nom { font-weight: 700; font-size: 14px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.carte-corps { padding: 0 15px 12px; display: flex; flex-direction: column; gap: 6px; }
.carte-l { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; }
.carte-l span { color: var(--muted); }
.carte-l b { font-weight: 600; }
.carte-l b.mono { font-family: var(--font-mono); font-size: 11px; color: var(--ink-2);
                  max-width: 62%; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.carte-cible { padding: 8px 15px; border-top: 1px solid var(--border); font-family: var(--font-mono);
               font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: var(--font-mono); }

/* ── Page Paramètres : formulaire d'ajout ────────────────── */
.form-ajout {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px; padding: 20px; align-items: start;
}
.form-ajout .field { display: flex; flex-direction: column; gap: 5px; }
.form-ajout label { font-size: 11px; text-transform: uppercase; letter-spacing: .8px;
                    color: var(--muted); font-weight: 600; }
.form-ajout input, .form-ajout select {
    padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    background: var(--bg); color: var(--ink); font-family: var(--font-sans); font-size: 14px;
}
.form-ajout input:focus, .form-ajout select:focus {
    outline: 2px solid var(--tbpc-red); outline-offset: 1px; border-color: var(--tbpc-red);
}
.form-ajout small { color: var(--muted-2); font-size: 11px; }
.form-ajout .field-action { justify-content: flex-end; }
.form-ajout .field-action .btn { margin-top: 18px; }

.btn-danger { background: transparent; border-color: rgba(239,74,79,.4); color: #fca5a5;
              padding: 6px 12px; font-size: 12px; }
.btn-danger:hover { background: rgba(239,74,79,.15); border-color: var(--tbpc-red); }
.badge-type { font-family: var(--font-mono); font-size: 10px; letter-spacing: .5px;
              background: var(--surface-2); color: var(--muted); padding: 3px 7px; border-radius: 4px; }
.page-meta a { color: var(--muted); font-size: 13px; }
.page-meta a:hover { color: var(--tbpc-red); }
