/* ============================================================
   VPN Manager — Feuille de style
   Palette : bleu #2E86C1 · vert accent #7CB342
   ============================================================ */

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

:root {
    --primary:        #2E86C1;
    --primary-hover:  #2471A3;
    --primary-light:  #EBF5FB;
    --accent:         #7CB342;
    --accent-hover:   #689F38;
    --danger:         #dc2626;
    --danger-hover:   #b91c1c;
    --danger-light:   #fef2f2;
    --warning:        #d97706;
    --warning-light:  #fffbeb;
    --success:        #16a34a;
    --success-light:  #f0fdf4;

    --sidebar-w:  250px;
    --topbar-h:   56px;
    --bg:         #f0f4f8;
    --surface:    #ffffff;
    --border:     #dce3eb;
    --shadow:     0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:  0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);

    --text:    #1a2332;
    --muted:   #5a6a7e;
    --radius:  10px;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
}

a { color: var(--primary); }
a:hover { color: var(--primary-hover); }

/* ═══════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════ */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: #1a2332;
    border-right: none;
    display: flex; flex-direction: column;
    z-index: 200; overflow-y: auto; overflow-x: hidden;
    transition: transform .25s ease;
}

.sidebar-brand {
    display: flex; align-items: center; justify-content: center;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0; text-decoration: none;
}
.sidebar-brand-logo {
    max-width: 180px;
    width: 100%;
    height: auto;
    filter: brightness(0) invert(1);
}

.sidebar-nav { flex: 1; padding: .5rem 0; overflow-y: auto; }

.nav-section-label {
    font-size: .6rem; font-weight: 700; letter-spacing: .12em;
    text-transform: uppercase; color: rgba(255,255,255,.3);
    padding: 1rem 1.25rem .35rem; user-select: none;
}

.nav-link {
    display: flex; align-items: center; gap: .65rem;
    padding: .6rem 1.25rem; color: rgba(255,255,255,.55);
    text-decoration: none; font-size: .84rem; font-weight: 500;
    border-left: 3px solid transparent;
    transition: all .15s ease;
    cursor: pointer; user-select: none;
}
.nav-link:hover        { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.active       { background: rgba(255,255,255,.1); color: #fff;
                         border-left-color: var(--primary); font-weight: 600; }
.nav-link.group-active { color: #fff; font-weight: 600; }

.nav-icon    { flex-shrink: 0; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; }
.nav-icon svg { display: block; width: 18px; height: 18px; }
.nav-label   { flex: 1; }
.nav-chevron { font-size: .75rem; color: rgba(255,255,255,.3); transition: transform .2s; }
.nav-chevron.open { transform: rotate(90deg); }

.nav-sub {
    display: none; background: rgba(0,0,0,.2);
    border-left: 2px solid rgba(255,255,255,.06);
    margin: 0 0 .2rem 2.8rem; border-radius: 0 0 6px 6px;
}
.nav-sub.open { display: block; }

.nav-sub-link {
    display: block; padding: .45rem 1rem; font-size: .8rem;
    color: rgba(255,255,255,.45); text-decoration: none;
    border-left: 2px solid transparent;
    transition: all .12s ease;
}
.nav-sub-link:hover  { color: #fff; background: rgba(255,255,255,.05); }
.nav-sub-link.active { color: #5ba8d9; font-weight: 600; border-left-color: var(--primary); }
.nav-count-badge {
    display: inline-block; min-width: 18px; height: 18px;
    background: #dc2626; color: #fff; font-size: .65rem; font-weight: 700;
    border-radius: 9px; text-align: center; line-height: 18px;
    padding: 0 5px; margin-left: 6px; vertical-align: middle;
}

.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,.08); padding: 1rem 1.25rem; flex-shrink: 0;
}
.sidebar-user { margin-bottom: .75rem; }
.sidebar-user strong { display: block; font-size: .84rem; color: #fff; }
.sidebar-user small  { font-size: .73rem; color: rgba(255,255,255,.4); }

.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(15,23,42,.45); z-index: 190;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.visible { display: block; }

/* ═══════════════════════════════════════════════════════════
   TOPBAR MOBILE
   ═══════════════════════════════════════════════════════════ */
.topbar {
    display: none; position: fixed; top: 0; left: 0; right: 0;
    height: var(--topbar-h); background: var(--surface);
    border-bottom: 1px solid var(--border);
    align-items: center; padding: 0 1.25rem; gap: .75rem;
    z-index: 180; box-shadow: var(--shadow);
}
.topbar-toggle {
    background: none; border: none; cursor: pointer;
    font-size: 1.4rem; color: var(--text); padding: .25rem; line-height: 1;
}

/* ═══════════════════════════════════════════════════════════
   PAGE WRAPPER
   ═══════════════════════════════════════════════════════════ */
.page-wrapper { margin-left: var(--sidebar-w); min-height: 100vh; }
.container { width: 100%; max-width: 1440px; margin: 0 auto; padding: 2rem; }

.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1.75rem; flex-wrap: wrap; gap: 1rem;
}
.page-title    { font-size: 1.35rem; font-weight: 700; color: var(--text); }
.page-subtitle { font-size: .82rem; color: var(--muted); margin-top: .15rem; }

/* ═══════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════ */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.5rem;
}
.card-header {
    padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.card-title {
    font-size: .88rem; font-weight: 600; color: var(--text);
    display: flex; align-items: center; gap: .45rem;
}
.card-body { padding: 1.25rem; }

/* ═══════════════════════════════════════════════════════════
   DASHBOARD
   ═══════════════════════════════════════════════════════════ */

/* ── Top bar ── */
.db-topbar {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 1.5rem; gap: 1rem;
}
.db-title   { font-size: 1.35rem; font-weight: 700; color: var(--text); }
.db-subtitle { font-size: .82rem; color: var(--muted); margin-top: .15rem; }
.db-refresh { display: flex; align-items: center; gap: .45rem; font-size: .78rem; color: var(--muted); padding-top: .25rem; }
.db-refresh-dot {
    width: 8px; height: 8px; border-radius: 50%; background: var(--success);
    flex-shrink: 0; transition: opacity .2s;
}
.db-refresh-dot--spin { animation: dbPulse .6s ease; }
@keyframes dbPulse { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ── KPI grid ── */
.db-kpi-grid {
    display: grid; grid-template-columns: repeat(5,1fr);
    gap: 1rem; margin-bottom: 1.25rem;
}
.db-kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid transparent;
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem 1.1rem;
    display: flex; flex-direction: column; gap: .15rem;
    box-shadow: var(--shadow);
    transition: box-shadow .2s, transform .15s;
}
.db-kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.db-kpi-card--blue   { border-top-color: var(--primary); }
.db-kpi-card--indigo { border-top-color: #6366f1; }
.db-kpi-card--green  { border-top-color: var(--success); }
.db-kpi-card--red    { border-top-color: var(--danger); }

.db-kpi-label {
    font-size: .62rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .1em; color: var(--muted); margin-bottom: .1rem;
}
.db-kpi-value {
    font-size: 2.25rem; font-weight: 800; line-height: 1; color: var(--text);
    font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.db-kpi-value--green { color: var(--success); }
.db-kpi-value--red   { color: var(--danger); }
.db-kpi-sub {
    font-size: .72rem; color: var(--muted); margin-top: .3rem;
}
.db-kpi-flash { animation: kpiFlash .35s ease; }
@keyframes kpiFlash { 0%{opacity:.4} 100%{opacity:1} }

/* Barre de taux connexion */
.db-kpi-rate { display: flex; align-items: center; gap: .5rem; margin-top: .45rem; }
.db-kpi-rate-track { flex:1; height: 3px; background: var(--border); border-radius: 2px; overflow:hidden; }
.db-kpi-rate-fill  { height: 100%; background: var(--success); border-radius: 2px; transition: width .6s ease; }
.db-kpi-rate-pct   { font-size: .68rem; font-weight: 700; color: var(--success); min-width: 2.5rem; text-align:right; }

/* ── Charts row ── */
.db-charts-row {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1rem; margin-bottom: 1.25rem;
}
.db-panel--gauge { min-height: 0; }
.db-panel--area  { min-height: 0; }
.db-panel--gauge #zc-gauge,
.db-panel--area  #zc-area  { height: 220px !important; width: 100% !important; }
.db-panel-hint { font-size: .72rem; color: var(--muted); font-weight: 400; }
@media (max-width: 900px) {
    .db-charts-row { grid-template-columns: 1fr; }
}

/* ── Panels ── */
.db-panel {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    display: flex; flex-direction: column; overflow: hidden;
}
.db-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: .7rem 1.25rem;
    background: var(--bg); border-bottom: 1px solid var(--border);
    font-size: .82rem; gap: .75rem;
}
.db-panel-title {
    display: flex; align-items: center; gap: .6rem;
    font-weight: 600; color: var(--text);
}
.db-panel-accent {
    width: 3px; height: 16px; border-radius: 2px; flex-shrink: 0;
}
.db-panel-accent--blue   { background: var(--primary); }
.db-panel-accent--green  { background: var(--success); }
.db-panel-accent--indigo { background: #6366f1; }
.db-panel-accent--gray   { background: var(--muted); }
.db-panel-header a {
    font-size: .78rem; font-weight: 500; color: var(--primary);
    text-decoration: none; white-space: nowrap;
}
.db-panel-header a:hover { text-decoration: underline; }
.db-panel-badge {
    background: var(--success); color: #fff;
    font-size: .65rem; font-weight: 700;
    border-radius: 10px; padding: .1rem .45rem;
    margin-left: .25rem;
}

/* ── Org rows ── */
.db-org-row {
    display: flex; align-items: center; gap: .85rem;
    padding: .9rem 1.25rem; border-bottom: 1px solid var(--border);
}
.db-org-row:last-child { border-bottom: none; }
.db-org-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.db-org-dot--on  { background: var(--success); box-shadow: 0 0 0 3px rgba(22,163,74,.18); }
.db-org-dot--off { background: #cbd5e1; }
.db-org-info { flex: 1; min-width: 0; }
.db-org-name { font-weight: 600; font-size: .88rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.db-org-meta { font-size: .73rem; color: var(--muted); margin-top: .15rem; }
.db-org-right { text-align: right; flex-shrink: 0; min-width: 70px; }
.db-org-count { font-size: 1rem; font-weight: 700; color: var(--muted); }
.db-org-count span { font-size: .75rem; font-weight: 500; }
.db-org-count--on { color: var(--success); }
.db-org-bar { height: 4px; background: var(--border); border-radius: 2px; margin-top: .4rem; overflow:hidden; }
.db-org-bar-fill { height: 100%; background: var(--success); border-radius:2px; transition: width .6s ease; }

/* ── Conn table ── */
.db-conn-scroll {
    max-height: 360px;       /* ~10 lignes visibles */
    overflow-y: auto;
    overflow-x: auto;
    border-radius: 0 0 8px 8px;
    /* scrollbar discrète */
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.db-conn-scroll::-webkit-scrollbar { width: 5px; height: 5px; }
.db-conn-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.db-conn-table { width: 100%; border-collapse: collapse; font-size: .83rem; }
.db-conn-table--sticky thead th {
    position: sticky; top: 0; z-index: 1;
}
.db-conn-table thead th {
    padding: .55rem 1rem; font-size: .67rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
    background: var(--bg); border-bottom: 1px solid var(--border); text-align:left;
}
.db-conn-table tbody td {
    padding: .7rem 1rem; border-bottom: 1px solid var(--border); vertical-align:middle;
}
.db-conn-table tbody tr:last-child td { border-bottom: none; }
.db-conn-table tbody tr:hover td { background: #f8fafc; }
.db-conn-row--older td { opacity: .72; }
.db-conn-name { font-weight: 600; }
.db-conn-sub  { font-size: .73rem; color: var(--muted); margin-top: .1rem; }
.db-bytes     { font-family: 'SFMono-Regular', monospace; font-size: .78rem; color: var(--muted); }
.db-conn-more {
    padding: .55rem 1rem; font-size: .73rem; color: var(--muted);
    text-align: center; border-top: 1px dashed var(--border);
    background: var(--bg);
}

/* ── Journal de bord ── */
.journal-row {
    display: flex;
    align-items: baseline;
    gap: .6rem;
    padding: .45rem 1rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    transition: background .4s ease;
}
.journal-row:last-child { border-bottom: none; }
.journal-row--new { background: #f0f9ff; }
.journal-row:hover { background: #f8fafc; }
.journal-time {
    font-family: 'SFMono-Regular', monospace;
    font-size: .72rem;
    color: var(--muted);
    white-space: nowrap;
    flex-shrink: 0;
}
.journal-cn {
    font-weight: 600;
    font-size: .8rem;
    color: var(--text);
}
.journal-sub {
    font-weight: 400;
    font-size: .72rem;
    color: var(--muted);
    margin-left: .3rem;
}
.journal-detail {
    font-size: .75rem;
    color: var(--muted);
    flex: 1;
}
.db-ip { font-family: monospace; font-size: .82rem; background: var(--bg); padding: .15rem .45rem; border-radius: 4px; }
.db-uptime { font-family: monospace; font-size: .8rem; color: var(--success); font-weight: 600; }
.db-code { font-size: .75rem; background: var(--bg); padding: .1rem .35rem; border-radius: 4px; color: var(--muted); font-family: monospace; }

/* ── États vides / loading ── */
.db-empty   { padding: 2rem; text-align: center; color: var(--muted); font-size: .85rem; }
.db-loading { padding: 2rem; text-align: center; color: var(--muted); font-size: .85rem; }

/* ── Stats (legacy — conservé pour compat) ── */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem; margin-bottom: 2rem;
}
.stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.5rem 1.25rem; box-shadow: var(--shadow);
    display: flex; flex-direction: column; gap: .35rem;
    transition: box-shadow .2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-label {
    font-size: .7rem; color: var(--muted); font-weight: 600;
    text-transform: uppercase; letter-spacing: .06em;
}
.stat-value { font-size: 2.2rem; font-weight: 700; line-height: 1; }
.stat-value.green { color: var(--success); }
.stat-value.red   { color: var(--danger); }
.stat-value.blue  { color: var(--primary); }
.stat-value.amber { color: var(--warning); }
.stat-value.muted { color: var(--muted); }

/* ── VPN connexion card ── */
.vpn-card { border-left: 4px solid var(--primary); }
.vpn-card.vpn-active { border-left-color: var(--success); }

/* ═══════════════════════════════════════════════════════════
   TABLEAU
   ═══════════════════════════════════════════════════════════ */
.table-wrap {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
thead tr { background: var(--bg); }
th {
    padding: .75rem 1rem; text-align: left; font-size: .67rem;
    letter-spacing: .08em; text-transform: uppercase;
    color: var(--muted); font-weight: 600; white-space: nowrap;
}
td { padding: .8rem 1rem; border-top: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: #f7f9fb; }
.row-error td { background: var(--danger-light); }

/* ═══════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════ */
.badge {
    display: inline-block; padding: .2rem .6rem; border-radius: 6px;
    font-size: .72rem; font-weight: 600; white-space: nowrap;
}
.badge-blue   { background: #DCEEFB; color: #1A5276; }
.badge-green  { background: #D5F5E3; color: #186A3B; }
.badge-red    { background: #FADBD8; color: #922B21; }
.badge-amber  { background: #FEF9E7; color: #7D6608; }
.badge-gray   { background: #EAECEE; color: #5D6D7E; }
.badge-purple { background: #E8DAEF; color: #6C3483; }

.role-admin    { background: #DCEEFB; color: #1A5276; }
.role-operator { background: #D5F5E3; color: #186A3B; }
.role-viewer   { background: #EAECEE; color: #5D6D7E; }

.status-dot { display: inline-flex; align-items: center; gap: .4rem; font-weight: 500; font-size: .84rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.dot.online  { background: var(--success); box-shadow: 0 0 0 3px rgba(22,163,74,.18); }
.dot.alert   { background: var(--warning); box-shadow: 0 0 0 3px rgba(217,119,6,.18); }
.dot.offline { background: var(--danger);  box-shadow: 0 0 0 3px rgba(220,38,38,.18); }

/* ═══════════════════════════════════════════════════════════
   BOUTONS
   ═══════════════════════════════════════════════════════════ */
.btn {
    display: inline-flex; align-items: center; gap: .4rem; padding: .55rem 1.1rem;
    border-radius: 8px; font-size: .84rem; font-weight: 500; cursor: pointer;
    text-decoration: none; border: 1px solid transparent;
    transition: all .15s ease; white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover  { background: var(--primary-hover); box-shadow: var(--shadow); }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover   { background: var(--danger-hover); }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-warning:hover  { background: #b45309; }
.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover  { background: #15803d; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }
.sidebar .btn-secondary { background: rgba(255,255,255,.08); color: rgba(255,255,255,.75); border-color: rgba(255,255,255,.12); }
.sidebar .btn-secondary:hover { background: rgba(255,255,255,.14); color: #fff; }
.btn-sm   { padding: .32rem .7rem; font-size: .78rem; border-radius: 6px; }
.btn-group { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── Menu actions (⋮) ── */
.actions-cell { position: relative; white-space: nowrap; }
.btn-menu-trigger {
    background: none; border: 1px solid var(--border);
    border-radius: 6px; width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--muted);
    transition: background .15s, color .15s, border-color .15s;
}
.btn-menu-trigger:hover { background: var(--bg); color: var(--text); border-color: var(--primary); }

.action-menu {
    display: none; position: absolute;
    right: 0; top: calc(100% + 4px);
    z-index: 300;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.06);
    min-width: 200px; padding: .3rem 0;
}
.action-menu.open {
    display: block;
    animation: menuIn .12s ease;
}
@keyframes menuIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }

.action-menu-item {
    display: flex; align-items: center; gap: .6rem;
    width: 100%; padding: .5rem 1rem;
    background: none; border: none;
    font-size: .82rem; font-family: inherit;
    color: var(--text); text-decoration: none;
    cursor: pointer; text-align: left;
    transition: background .1s;
}
.action-menu-item:hover { background: var(--bg); color: var(--primary); }
.action-menu-item svg { flex-shrink:0; opacity:.7; }
.action-menu-item--danger { color: var(--danger); }
.action-menu-item--danger:hover { background: var(--danger-light); color: var(--danger); }
.action-menu-sep { height: 1px; background: var(--border); margin: .3rem 0; }

/* ── Modale suppression ── */
.del-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(15,23,42,.5); z-index: 1000;
    align-items: center; justify-content: center;
    backdrop-filter: blur(2px);
}
.del-overlay.open { display: flex; animation: delFadeIn .15s ease; }
@keyframes delFadeIn { from { opacity:0; } to { opacity:1; } }
.del-box {
    background: var(--surface); border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    padding: 2rem 2.25rem; max-width: 400px; width: 90%;
    text-align: center; animation: delSlideIn .15s ease;
}
@keyframes delSlideIn { from { transform:translateY(-12px); } to { transform:translateY(0); } }
.del-icon          { color: var(--danger); margin-bottom: .75rem; }
.del-icon--amber   { color: var(--warning); }
.del-title { font-size: 1.15rem; font-weight: 700; color: var(--text); margin-bottom: .5rem; }
.del-name { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: .15rem; }
.del-cn { font-size: .8rem; color: var(--muted); display: block; margin-bottom: 1rem; }
.del-warn { font-size: .82rem; color: var(--muted); line-height: 1.5; margin-bottom: 1.5rem; }
.del-actions { display: flex; gap: .75rem; justify-content: center; }

/* ═══════════════════════════════════════════════════════════
   FORMULAIRES
   ═══════════════════════════════════════════════════════════ */
.form-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); max-width: 860px;
}
.form-header { padding: 1.1rem 1.5rem; border-bottom: 1px solid var(--border); }
.form-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 1.1rem; }
.form-footer {
    padding: 1rem 1.5rem; border-top: 1px solid var(--border);
    display: flex; gap: .75rem; justify-content: flex-end;
}
.form-section { margin-bottom: 1.5rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--border); }
.form-section h2 { font-size: .95rem; font-weight: 600; margin-bottom: .75rem; color: var(--primary); }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .85rem; }
.form-label { font-size: .8rem; font-weight: 600; color: var(--text); }
.form-label .req { color: var(--danger); margin-left: .15rem; }
.form-control, input[type="text"], input[type="number"], input[type="password"],
input[type="email"], select, textarea {
    padding: .6rem .85rem; border: 1px solid var(--border); border-radius: 8px;
    font-size: .875rem; color: var(--text); background: var(--surface);
    transition: border-color .15s, box-shadow .15s; width: 100%;
    font-family: inherit;
}
.form-control:focus, input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(46,134,193,.12);
}
textarea { resize: vertical; min-height: 100px; font-family: 'SFMono-Regular', Consolas, monospace; font-size: .8rem; }
.form-hint { font-size: .73rem; color: var(--muted); }

/* ═══════════════════════════════════════════════════════════
   ALERTES
   ═══════════════════════════════════════════════════════════ */
.alert {
    padding: .85rem 1.15rem; border-radius: 8px; font-size: .84rem;
    display: flex; align-items: flex-start; gap: .6rem; margin-bottom: 1.25rem;
}
.alert-error   { background: var(--danger-light);  color: #991b1b; border: 1px solid rgba(220,38,38,.2); }
.alert-success { background: var(--success-light); color: #14532d; border: 1px solid rgba(22,163,74,.2); }
.alert-warning { background: var(--warning-light); color: #78350f; border: 1px solid rgba(217,119,6,.2); }
.alert-info    { background: var(--primary-light); color: #1A5276; border: 1px solid rgba(46,134,193,.2); }

/* ═══════════════════════════════════════════════════════════
   PAGE LOGIN
   ═══════════════════════════════════════════════════════════ */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(160deg, #1e2d3d 0%, #141e2b 55%, #0d1520 100%);
    padding: 1.5rem;
}
.login-card {
    background: var(--surface); border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2); width: 100%; max-width: 420px;
}
.login-header {
    padding: 2.5rem 2rem 1.5rem; text-align: center;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}
.login-header img { max-width: 180px; width: 100%; height: auto; margin-bottom: .5rem; }
.login-logo-big {
    font-size: 2.2rem; font-weight: 800; letter-spacing: -.03em;
    display: flex; align-items: baseline; gap: .2rem; justify-content: center;
    margin-bottom: .5rem;
}
.login-logo-big .vpn { color: var(--primary); }
.login-logo-big .mgr { color: var(--text); font-weight: 500; }
.login-subtitle { font-size: .8rem; color: var(--muted); }
.login-body { padding: 2rem; display: flex; flex-direction: column; gap: 1.1rem; }
.login-footer {
    padding: 1rem 2rem; border-top: 1px solid var(--border);
    text-align: center; background: var(--bg); border-radius: 0 0 16px 16px;
}
.login-footer small { font-size: .72rem; color: var(--muted); }

/* ═══════════════════════════════════════════════════════════
   DIVERS
   ═══════════════════════════════════════════════════════════ */
.filter-bar { display: flex; gap: .75rem; align-items: center; margin-bottom: 1.25rem; flex-wrap: wrap; }
.filter-bar select, .filter-bar input { max-width: 280px; }
.text-muted   { color: var(--muted); }
.text-center  { text-align: center; }
.nowrap       { white-space: nowrap; }
.inline-form  { display: inline-flex; gap: .5rem; align-items: center; }
code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    font-size: .82rem; background: var(--bg); padding: .15rem .45rem; border-radius: 5px;
    border: 1px solid var(--border);
}
.monospace { font-family: 'SFMono-Regular', Consolas, monospace; font-size: .82rem; }

/* ── Indicateur refresh ── */
.refresh-indicator {
    display: flex; align-items: center; gap: .5rem;
    font-size: .78rem; color: var(--muted); font-weight: 500;
}
.pulse-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--success); display: inline-block;
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(22,163,74,.4); }
    50% { opacity: .7; box-shadow: 0 0 0 6px rgba(22,163,74,0); }
}
.stat-flash { animation: flash .4s ease; }
@keyframes flash {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}
.dashboard-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 1.25rem; margin-bottom: 1.5rem;
}

/* ── Bloc info CCD ── */
.ccd-block {
    background: #0f172a; color: #e2e8f0;
    border-radius: 8px; padding: 1rem 1.25rem;
    font-family: 'SFMono-Regular', Consolas, monospace; font-size: .8rem;
    line-height: 1.7; overflow-x: auto;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-md); }
    .sidebar.open { transform: translateX(0); }
    .topbar { display: flex; }
    .page-wrapper { margin-left: 0; padding-top: var(--topbar-h); }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .db-kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .container { padding: 1.25rem 1rem; }
    .page-header { flex-direction: column; align-items: flex-start; }
    table { font-size: .8rem; }
    th, td { padding: .6rem .75rem; }
    .form-card { max-width: 100%; }
    .dashboard-grid { grid-template-columns: 1fr; }
    /* Modale : sous le topbar mobile, pleine largeur */
    .modal-backdrop { top: var(--topbar-h); left: 0; }
}
@media (max-width: 480px) {
    .db-kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-grid { grid-template-columns: 1fr; }
    .login-card { border-radius: 12px; }
    .login-header { padding: 1.75rem 1.25rem 1.25rem; }
    .login-body { padding: 1.5rem 1.25rem; }
}

/* ═══════════════════════════════════════════════════════════
   WIZARD FULL-PANEL (formulaire plein écran)
   ═══════════════════════════════════════════════════════════ */

body.wizard-page .page-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.wizard-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    background: var(--bg);
    overflow: hidden;
}

.wizard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 2rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.wizard-header-title h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text);
}

.wizard-header-title .wizard-subtitle {
    font-size: .8rem;
    color: var(--muted);
    margin-top: .2rem;
}

.wizard-close {
    font-size: 1.2rem;
    color: var(--muted);
    text-decoration: none;
    padding: .25rem .5rem;
    border-radius: 4px;
    line-height: 1;
    transition: background .15s, color .15s;
}
.wizard-close:hover {
    background: var(--bg);
    color: var(--text);
}

.wizard-tabs {
    display: flex;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    overflow-x: auto;
}

.wizard-tab {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    color: var(--muted);
    font-size: .84rem;
    font-weight: 500;
    white-space: nowrap;
    transition: color .15s, background .15s;
    font-family: inherit;
}
.wizard-tab:hover:not(.active) {
    background: var(--bg);
    color: var(--text);
}
.wizard-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.tab-num {
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    font-weight: 700;
    background: var(--border);
    color: var(--muted);
    flex-shrink: 0;
    transition: background .15s, color .15s;
}
.wizard-tab.active .tab-num {
    background: var(--primary);
    color: #fff;
}

.wizard-panel > form {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.wizard-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.wizard-tab-pane {
    display: none;
}
.wizard-tab-pane.active {
    display: block;
}

.wizard-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.wizard-footer-right {
    display: flex;
    gap: .75rem;
    align-items: center;
}

body.wizard-page .wizard-content .alert {
    margin-bottom: 1.25rem;
}

/* ── Toggle Switch ── */
.toggle-switch { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; }
.toggle-switch input { display: none; }
.toggle-track {
    position: relative; width: 36px; height: 20px;
    background: var(--border); border-radius: 20px;
    transition: background .2s;
    flex-shrink: 0;
}
.toggle-track::after {
    content: ''; position: absolute; top: 3px; left: 3px;
    width: 14px; height: 14px; border-radius: 50%;
    background: #fff; transition: left .2s;
}
.toggle-switch input:checked + .toggle-track { background: var(--primary); }
.toggle-switch input:checked + .toggle-track::after { left: 19px; }

@media (max-width: 900px) {
    body.wizard-page .page-wrapper { margin-left: 0; padding-top: var(--topbar-h); }
    .wizard-panel { height: calc(100vh - var(--topbar-h)); }
    .wizard-header { padding: 1rem 1.25rem; }
    .wizard-tab { padding: .65rem 1rem; }
    .wizard-content { padding: 1.25rem; }
    .wizard-footer { padding: .75rem 1.25rem; flex-wrap: wrap; gap: .5rem; }
    .wizard-footer-right { flex-wrap: wrap; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODALE PERSONNALISÉE
   ═══════════════════════════════════════════════════════════════════════════ */

.vm-modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15, 25, 40, .55);
    backdrop-filter: blur(3px);
    z-index: 9000;
    align-items: center;
    justify-content: center;
}
.vm-modal-overlay.open {
    display: flex;
    animation: vmFadeIn .15s ease;
}
@keyframes vmFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.vm-modal {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2), 0 4px 16px rgba(0,0,0,.12);
    padding: 2rem;
    width: 100%;
    max-width: 420px;
    margin: 1rem;
    animation: vmSlideUp .18s ease;
    text-align: center;
}
@keyframes vmSlideUp {
    from { transform: translateY(12px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
.vm-modal-icon  { font-size: 2.5rem; margin-bottom: .75rem; line-height: 1; }
.vm-modal-title { font-size: 1.05rem; font-weight: 700; color: var(--text); margin-bottom: .5rem; }
.vm-modal-msg   { font-size: .875rem; color: var(--muted); margin-bottom: 1.5rem; line-height: 1.5; }
.vm-modal-footer { display: flex; gap: .75rem; justify-content: center; }
.vm-modal-footer .btn { min-width: 100px; }

.vm-modal-form { max-width: 560px; text-align: left; padding: 0; }
.vm-modal-form .vm-modal-header,
.vm-modal-form .vm-modal-body,
.vm-modal-form .vm-modal-footer { text-align: left; }

.vm-modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.vm-modal-header h3 { margin: 0; font-size: 1rem; font-weight: 600; color: var(--text); }
.vm-modal-body  { padding: 1.5rem; overflow-y: auto; flex: 1; max-height: 70vh; }
.vm-modal-footer {
    padding: 1rem 1.5rem; border-top: 1px solid var(--border);
    display: flex; gap: .75rem; justify-content: flex-end;
}

.vm-modal-close {
    background: none; border: none; font-size: 1.4rem; color: var(--muted);
    cursor: pointer; line-height: 1; padding: .1rem .3rem;
    border-radius: 4px; transition: background .12s, color .12s;
}
.vm-modal-close:hover { background: var(--bg); color: var(--text); }

/* ═══════════════════════════════════════════════════════════
   TOASTS
   ═══════════════════════════════════════════════════════════ */
#toast-container {
    position: fixed; bottom: 1.5rem; right: 1.5rem;
    display: flex; flex-direction: column; gap: .5rem;
    z-index: 9999; pointer-events: none;
    max-width: 380px; width: calc(100vw - 3rem);
}
.toast {
    display: flex; align-items: center; gap: .75rem;
    padding: .75rem 1rem;
    border-radius: 8px; font-size: .85rem; font-weight: 500;
    pointer-events: all;
    box-shadow: 0 4px 20px rgba(0,0,0,.14);
    position: relative; overflow: hidden;
    animation: toastIn .25s ease;
}
.toast.hiding { animation: toastOut .3s ease forwards; }
.toast-success { background:#f0fdf4; color:#14532d; border:1px solid rgba(22,163,74,.25); }
.toast-error   { background:#fef2f2; color:#991b1b; border:1px solid rgba(220,38,38,.25); }
.toast-warning { background:#fffbeb; color:#78350f; border:1px solid rgba(217,119,6,.25); }
.toast-info    { background:#eff6ff; color:#1e3a5f; border:1px solid rgba(59,130,246,.25); }
.toast-icon  { font-size:1rem; flex-shrink:0; }
.toast-msg   { flex:1; line-height:1.4; }
.toast-close {
    background:none; border:none; cursor:pointer;
    opacity:.45; font-size:1.1rem; padding:0; line-height:1;
    flex-shrink:0; transition: opacity .15s;
}
.toast-close:hover { opacity:1; }
.toast-bar {
    position:absolute; bottom:0; left:0; height:3px;
    background:currentColor; opacity:.25;
    animation: toastBar 3s linear forwards;
}
@keyframes toastIn  { from { opacity:0; transform:translateX(1.5rem); } to { opacity:1; transform:translateX(0); } }
@keyframes toastOut { to   { opacity:0; transform:translateX(1.5rem); max-height:0; padding:0; margin:0; } }
@keyframes toastBar { from { width:100%; } to { width:0; } }

/* ═══════════════════════════════════════════════════════════
   RSSI / Signal badge
   ═══════════════════════════════════════════════════════════ */
.rssi-badge-wrap { display:flex; flex-direction:column; gap:1px; }
.rssi-value      { font-family:'SFMono-Regular',monospace; font-size:.83rem; font-weight:700; }
.rssi-meta       { font-size:.7rem; color:var(--muted); }
.rssi-loading    { font-size:.75rem; color:var(--muted); animation: pulse 1.5s infinite; }
.rssi-na         { font-size:.75rem; color:#cbd5e1; }

/* ═══════════════════════════════════════════════════════════
   PKI — Étapes de génération
   ═══════════════════════════════════════════════════════════ */
.pki-step {
    padding: .5rem .75rem; margin: .25rem 0; border-radius: 4px;
    font-size: .875rem; display: flex; align-items: center; gap: .5rem;
}
.pki-step-pending { color: var(--muted); background: var(--bg); }
.pki-step-running { color: #1565c0; background: #e3f2fd; font-weight: 500; }
.pki-step-done    { color: #2e7d32; background: #e8f5e9; }

/* ═══════════════════════════════════════════════════════════
   MODALE Signal 4G (connexions.php)
   ═══════════════════════════════════════════════════════════ */

/* Plein écran — zone contenu (hors sidebar, hors topbar sur mobile) */
.modal-backdrop {
    position: fixed;
    top: 0;                   /* desktop : pas de topbar */
    left: var(--sidebar-w);   /* desktop : sidebar visible */
    right: 0;
    bottom: 0;
    background: var(--bg);
    z-index: 900;
    display: flex;
    align-items: stretch;
    animation: fadeIn .12s ease;
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

/* La boîte occupe tout l'espace disponible */
.modal-box {
    background: var(--surface);
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
    box-shadow: none;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.modal-box.modal-lg { max-width: none; }

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem 1rem;
    border-bottom: 1px solid var(--border);
}
.modal-title    { font-size: 1.1rem; font-weight: 700; color: var(--text); margin: 0 0 .15rem; }
.modal-subtitle { font-size: .8rem; color: var(--muted); margin: 0; }
.modal-close {
    flex-shrink: 0;
    width: 32px; height: 32px;
    border: none; background: var(--bg);
    border-radius: 8px; cursor: pointer;
    font-size: 1.2rem; line-height: 32px; text-align: center;
    color: var(--muted); transition: background .15s, color .15s;
}
.modal-close:hover { background: var(--border); color: var(--text); }

/* KPIs en haut de la modale */
.modal-kpi-row {
    display: flex; gap: .75rem; flex-wrap: wrap;
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}
.modal-kpi {
    flex: 1; min-width: 90px;
    text-align: center;
    padding: .6rem .5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
}
.modal-kpi-value {
    font-family: 'SFMono-Regular', monospace;
    font-size: .88rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.modal-kpi-label {
    font-size: .65rem;
    color: var(--muted);
    margin-top: .25rem;
    text-transform: uppercase;
    letter-spacing: .06em;
}

/* Sections internes */
.modal-section {
    padding: 1rem 1.5rem;
}
.modal-section + .modal-section {
    border-top: 1px solid var(--border);
}
.modal-section-title {
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    margin-bottom: .6rem;
}

/* Sélecteur de période */
.modal-period-bar {
    display: flex;
    gap: .3rem;
    align-items: center;
}
.period-btn {
    padding: .25rem .65rem;
    font-size: .75rem;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--muted);
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    white-space: nowrap;
}
.period-btn:hover          { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.period-btn--active        { background: var(--primary); color: #fff; border-color: var(--primary); }
.period-btn--active:hover  { background: var(--primary-hover); border-color: var(--primary-hover); }

/* Table de détail dans la modale */
.modal-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: .82rem;
}
.modal-table th {
    width: 38%;
    text-align: left;
    padding: .28rem .4rem;
    color: var(--muted);
    font-weight: 500;
    white-space: nowrap;
    font-size: .75rem;
}
.modal-table td {
    padding: .28rem .4rem;
    color: var(--text);
    font-family: 'SFMono-Regular', monospace;
    font-size: .78rem;
    overflow-wrap: break-word;
    word-break: break-all;
}
.modal-table tr:hover td { background: #f8fafc; }

/* Survol des lignes de connexion */
.connexion-row:hover td { background: #f0f7ff; }

/* Bascule Graphiques / Tableau (etats.php) */
.view-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}
.view-btn {
    display: flex; align-items: center; gap: .35rem;
    padding: .35rem .85rem;
    font-size: .8rem; font-weight: 500;
    border: none; background: transparent;
    color: var(--muted); cursor: pointer;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.view-btn + .view-btn { border-left: 1px solid var(--border); }
.view-btn--active { background: var(--primary); color: #fff; }
.view-btn:hover:not(.view-btn--active) { background: var(--primary-light); color: var(--primary); }

/* Cellule SNMP cliquable */
.snmp-cell:hover { background: #eff6ff !important; border-radius: 6px; }
.pki-step-error   { color: #c62828; background: #ffebee; }
