:root {
    --bg: #eef0f6;
    --carte-bg: #ffffff;
    --texte: #171a2b;
    --texte-doux: #6b7080;
    --texte-tres-doux: #9498a8;
    --accent: #5b4dff;
    --accent-clair: #7c6fff;
    --accent-fonce: #4638d9;
    --bordure: #e8e9f2;
    --vert: #0d9f6e;
    --vert-fond: #e7faf3;
    --rouge: #e0334f;
    --rouge-fond: #fdecef;
    --gris: #9498a8;
    --gris-fond: #f1f2f7;
    --radius: 18px;
    --ombre: 0 4px 20px rgba(30, 30, 70, 0.06);
    --ombre-hover: 0 16px 34px rgba(30, 30, 70, 0.13);
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
}

body {
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background:
        radial-gradient(circle at 10% 0%, #f0eeff 0%, transparent 45%),
        radial-gradient(circle at 90% 10%, #e9f6ff 0%, transparent 40%),
        var(--bg);
    color: var(--texte);
}

/* ---- Page de connexion ---- */
.page-login {
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-box {
    background: var(--carte-bg);
    padding: 44px 40px 40px;
    border-radius: 24px;
    box-shadow: var(--ombre-hover);
    width: 100%;
    max-width: 360px;
    border: 1px solid var(--bordure);
    margin: auto;
}

.login-footer {
    text-align: center;
    font-size: 12.5px;
    color: var(--texte-tres-doux);
    padding: 20px;
    font-weight: 500;
}

.login-mark {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent-clair), var(--accent-fonce));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin: 0 auto 20px;
    box-shadow: 0 8px 18px rgba(91, 77, 255, 0.35);
}

.login-box h1 {
    text-align: center;
    margin: 0 0 28px;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.login-box label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    margin-bottom: 7px;
    margin-top: 18px;
    color: var(--texte-doux);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.login-box input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--bordure);
    border-radius: 11px;
    font-size: 14.5px;
    font-family: inherit;
    background: #fbfbfe;
    transition: border-color 0.15s, background 0.15s;
}

.login-box input:focus {
    outline: none;
    border-color: var(--accent);
    background: white;
}

.login-box button {
    width: 100%;
    margin-top: 26px;
    padding: 13px;
    background: linear-gradient(135deg, var(--accent-clair), var(--accent));
    color: white;
    border: none;
    border-radius: 11px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(91, 77, 255, 0.28);
    transition: transform 0.12s, box-shadow 0.12s;
}

.login-box button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(91, 77, 255, 0.35);
}

.login-box button:active { transform: translateY(0); }

.erreur {
    background: var(--rouge-fond);
    color: var(--rouge);
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 13px;
    text-align: center;
    font-weight: 600;
    margin: 0 0 4px;
}

/* ---- En-tête du dashboard ---- */
.site-header {
    background: var(--carte-bg);
    border-bottom: 1px solid var(--bordure);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 20px 44px;
    max-width: 1180px;
    margin: 0 auto;
    gap: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16.5px;
    font-weight: 800;
    letter-spacing: -0.01em;
    justify-self: start;
}

.brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--accent-clair), var(--accent-fonce));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    box-shadow: 0 6px 14px rgba(91, 77, 255, 0.3);
}

.header-center {
    text-align: center;
}

.header-center h1 {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin: 0 0 3px;
}

.sous-titre {
    color: var(--texte-doux);
    font-size: 13px;
    margin: 0;
    font-weight: 500;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
    justify-self: end;
}

.user-chip {
    font-size: 13px;
    font-weight: 600;
    color: var(--texte-doux);
    background: var(--gris-fond);
    padding: 7px 14px;
    border-radius: 999px;
    white-space: nowrap;
}

.btn-logout {
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
    font-size: 13.5px;
    padding: 7px 14px;
    border-radius: 999px;
    transition: background 0.15s;
    white-space: nowrap;
}

.btn-logout:hover { background: #f1effe; }

/* ---- Contenu principal ---- */
main {
    flex: 1;
    padding: 44px 44px 60px;
    max-width: 1180px;
    margin: 0 auto;
    width: 100%;
}

/* ---- Grille de tuiles ---- */
.grille {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.carte {
    background: var(--carte-bg);
    border-radius: var(--radius);
    box-shadow: var(--ombre);
    border: 1px solid var(--bordure);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.carte:hover {
    transform: translateY(-5px);
    box-shadow: var(--ombre-hover);
}

.carte-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 18px;
}

.favicon-wrap {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: linear-gradient(160deg, #f7f7fb, #edeef5);
    border: 1px solid var(--bordure);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(30, 30, 70, 0.06);
}

.favicon-wrap img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.favicon-secours {
    display: none;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 22px;
    font-weight: 800;
    color: var(--accent);
}

.statut-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 700;
    padding: 5px 11px;
    border-radius: 999px;
    background: var(--gris-fond);
    margin-top: 4px;
}

.statut-point {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.statut-en_ligne { color: var(--vert); }
.statut-en_ligne .statut-point { background: var(--vert); box-shadow: 0 0 0 3px rgba(13, 159, 110, 0.18); }

.statut-hors_ligne { color: var(--rouge); }
.statut-hors_ligne .statut-point { background: var(--rouge); box-shadow: 0 0 0 3px rgba(224, 51, 79, 0.18); }

.statut-inconnu { color: var(--gris); }
.statut-inconnu .statut-point { background: var(--gris); }

.carte-corps {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.carte h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px;
    letter-spacing: -0.01em;
}

.description {
    font-size: 14px;
    color: var(--texte-doux);
    margin: 0 0 20px;
    line-height: 1.5;
    flex-grow: 1;
}

.carte-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    border-top: 1px solid var(--bordure);
}

.derniere-verif {
    font-size: 12px;
    color: var(--texte-tres-doux);
    font-weight: 500;
}

.btn-ouvrir {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--accent);
    font-size: 13.5px;
    font-weight: 700;
    transition: gap 0.15s;
}

.btn-ouvrir:hover { gap: 9px; }

.fleche { transition: transform 0.15s; }

/* ---- Pied de page ---- */
.site-footer {
    border-top: 1px solid var(--bordure);
    padding: 22px 44px;
    margin-top: auto;
}

.footer-inner {
    max-width: 1180px;
    margin: 0 auto;
    text-align: center;
    font-size: 12.5px;
    color: var(--texte-tres-doux);
    font-weight: 500;
}

.footer-sep {
    margin: 0 8px;
    color: var(--bordure);
}

@media (max-width: 640px) {
    .header-inner {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 10px;
    }
    .brand, .topbar-right { justify-self: center; }
    main, .header-inner, .footer-inner { padding-left: 20px; padding-right: 20px; }
    .footer-inner span { display: block; margin: 3px 0; }
    .footer-sep { display: none; }
}
