/* ============================================================
   Portail folirex.me — thème sombre, accent rouge du panel
   ============================================================ */
:root {
    --bg: #0f1012;
    --bg-2: #16181b;
    --card: #1b1d21;
    --card-2: #222429;
    --line: #2c2f35;
    --text: #e8e6e3;
    --muted: #9a9ca3;
    --accent: #b8372f;
    --accent-2: #d2453b;
    --ok: #3fa66b;
    --warn: #d39b2a;
    --radius: 14px;
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    min-height: 100vh;
    background:
        radial-gradient(900px 500px at 85% -10%, rgba(184, 55, 47, .16), transparent 60%),
        radial-gradient(700px 400px at -10% 110%, rgba(184, 55, 47, .08), transparent 60%),
        var(--bg);
    color: var(--text);
    font: 15px/1.5 var(--font);
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3 { margin: 0 0 6px; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 650; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ── Mise en page ───────────────────────────────────────── */
body.center { display: grid; place-items: center; padding: 24px 16px; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px 60px; }

.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    max-width: 1040px; margin: 0 auto; padding: 22px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; text-decoration: none; }
.brand-mark {
    width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
    background: var(--accent); color: #fff; font-weight: 800; font-size: 16px;
}
.topbar nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.who { color: var(--muted); font-size: 14px; margin-right: 4px; }

.card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 28px; box-shadow: 0 10px 40px rgba(0, 0, 0, .35);
}
.card.narrow { width: 100%; max-width: 400px; }

/* ── Formulaires ───────────────────────────────────────── */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=password] {
    width: 100%; padding: 11px 12px; border-radius: 10px;
    background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
    font: inherit; outline: none; transition: border-color .15s;
}
input:focus { border-color: var(--accent); }
.check { display: flex; align-items: center; gap: 9px; margin: 6px 0; cursor: pointer; user-select: none; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; }
.error { color: #ff8a80; font-size: 14px; min-height: 20px; margin: 4px 0 10px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 16px; border-radius: 10px; border: 1px solid transparent;
    background: var(--accent); color: #fff; font: 600 14px var(--font);
    cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: var(--accent-2); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.block { width: 100%; padding: 12px; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn.ghost:hover { background: var(--card-2); }
.btn.danger { background: transparent; border-color: #5a2723; color: #ff8a80; }
.btn.danger:hover { background: #2a1513; }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }

/* ── Connexion ─────────────────────────────────────────── */
.login-head { text-align: center; margin-bottom: 22px; }
.login-head .brand-mark { width: 48px; height: 48px; border-radius: 13px; font-size: 22px; margin: 0 auto 14px; }

/* ── Accueil : tuiles ──────────────────────────────────── */
.hello { margin: 18px 0 26px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.tile {
    position: relative; display: flex; flex-direction: column; gap: 14px;
    padding: 24px; border-radius: var(--radius); text-decoration: none;
    background: var(--card); border: 1px solid var(--line);
    transition: transform .15s, border-color .15s, background .15s;
}
.tile:hover { transform: translateY(-3px); border-color: var(--accent); background: var(--card-2); }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.tile-icon {
    width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center;
    background: rgba(184, 55, 47, .14); color: var(--accent-2);
}
.tile-icon svg { width: 26px; height: 26px; }
.tile h2 { margin: 0; }
.tile p { margin: 0; color: var(--muted); font-size: 14px; }
.tile-go { margin-top: auto; font-size: 13px; font-weight: 600; color: var(--accent-2); }
.empty {
    padding: 34px; text-align: center; color: var(--muted);
    border: 1px dashed var(--line); border-radius: var(--radius);
}

/* ── Admin ─────────────────────────────────────────────── */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 30px 0 14px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.apps-pick { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 4px 0 14px; }

.users { display: grid; gap: 12px; }
.user {
    display: grid; grid-template-columns: minmax(160px, 1.2fr) 2fr auto; gap: 16px; align-items: center;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
}
.user.off { opacity: .6; }
.user-name { font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-meta { font-size: 12.5px; color: var(--muted); }
.badge {
    display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
    padding: 2px 7px; border-radius: 6px; background: var(--card-2); color: var(--muted); border: 1px solid var(--line);
}
.badge.admin { background: rgba(184, 55, 47, .16); color: var(--accent-2); border-color: transparent; }
.badge.off { background: rgba(211, 155, 42, .14); color: var(--warn); border-color: transparent; }
.user-apps { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.user-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

/* ── Dialogue ──────────────────────────────────────────── */
dialog {
    border: 1px solid var(--line); border-radius: var(--radius); padding: 0;
    background: var(--card); color: var(--text); width: min(440px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(0, 0, 0, .6); }
.dlg-body { padding: 24px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ── Notifications ─────────────────────────────────────── */
#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; }
.toast {
    background: var(--card-2); border: 1px solid var(--line); border-left: 4px solid var(--ok);
    padding: 11px 14px; border-radius: 10px; max-width: 340px; box-shadow: 0 8px 30px rgba(0, 0, 0, .4);
}
.toast.error { border-left-color: var(--accent); }

@media (max-width: 720px) {
    .user { grid-template-columns: 1fr; }
    .user-actions { justify-content: flex-start; }
    .grid2 { grid-template-columns: 1fr; }
    .card { padding: 22px; }
}
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

/* ── Page Serveur ──────────────────────────────────────── */
.small { font-size: 13px; }
.live { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); margin-right: 4px; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(63, 166, 107, .6); animation: pulse 2s infinite; }
.live.down i { background: var(--accent); animation: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(63, 166, 107, 0); } 100% { box-shadow: 0 0 0 0 rgba(63, 166, 107, 0); } }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.stat {
    position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 2px;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px 16px;
}
.stat-k { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat-v { font-size: 30px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat-v.warn { color: var(--warn); }
.stat-v.crit { color: var(--accent-2); }
.stat-v.net { font-size: 19px; display: flex; flex-direction: column; line-height: 1.35; }
.stat-s { font-size: 13px; min-height: 19px; }
.spark { width: 100%; height: 42px; margin-top: 10px; display: block; overflow: visible; }
.spark .line { fill: none; stroke: var(--accent-2); stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.spark .area { fill: rgba(184, 55, 47, .16); stroke: none; }

.meter { height: 7px; background: var(--bg-2); border-radius: 99px; overflow: hidden; margin: 6px 0 4px; }
.meter > i { display: block; height: 100%; width: 0; background: var(--ok); border-radius: 99px; transition: width .5s; }
.meter.warn > i { background: var(--warn); }
.meter.crit > i { background: var(--accent); }
.meter.big { height: 10px; margin-top: 18px; }

.details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.details .card { padding: 20px 22px; box-shadow: none; }
.details h2 { font-size: 16px; margin-bottom: 12px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.disk { padding: 8px 0 10px; border-bottom: 1px solid var(--line); }
.disk:last-child { border-bottom: none; padding-bottom: 0; }
.disk:first-child { padding-top: 0; }
.disk-head { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }

.badge.ok { background: rgba(63, 166, 107, .15); color: var(--ok); border-color: transparent; }
.procs { display: grid; gap: 10px; }
.proc {
    display: grid; grid-template-columns: 230px minmax(0, 1fr) 210px; gap: 16px; align-items: center;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px;
}
.proc.off { border-color: #5a2723; }
.proc-name { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot.ok { background: var(--ok); }
.dot.down { background: var(--accent); }
.proc-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; font-variant-numeric: tabular-nums; font-weight: 600; }
.proc-metrics small { display: block; font-size: 11.5px; font-weight: 500; color: var(--muted); }
.proc-actions { display: flex; gap: 6px; justify-content: flex-end; }

@media (max-width: 720px) {
    .proc { grid-template-columns: 1fr; }
    .details { grid-template-columns: 1fr; }
    .proc-metrics { grid-template-columns: repeat(2, 1fr); }
    .proc-actions { justify-content: flex-start; }
    .kv { grid-template-columns: 1fr; gap: 0; }
    .kv dd { margin-bottom: 8px; }
}
