:root {
    --navy: #1b2a4a;
    --navy-clair: #24365e;
    --coral: #ff6b5e;
    --teal: #2ec4b6;
    --orange: #ff9f45;
    --texte: #e8ecf4;
    --texte-attenue: #9fb0cc;
    --fond: #0f1830;
    --carte: #17233f;
    --bordure: #2a3a60;
    --ok: #2ec4b6;
    --attention: #ff9f45;
    --danger: #ff6b5e;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--fond);
    color: var(--texte);
    min-height: 100vh;
}

a { color: var(--teal); }

.entete {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 24px;
    background: var(--navy);
    border-bottom: 1px solid var(--bordure);
}
.entete img.logo { height: 44px; width: 44px; border-radius: 50%; object-fit: cover; }
.entete .titre { font-weight: 700; font-size: 1.1rem; }
.entete .titre small { display: block; font-weight: 400; color: var(--texte-attenue); font-size: 0.75rem; }
.entete .spacer { flex: 1; }
.entete .utilisateur { color: var(--texte-attenue); font-size: 0.9rem; }
.entete button.deconnexion {
    background: transparent; border: 1px solid var(--bordure); color: var(--texte);
    padding: 6px 12px; border-radius: 6px; cursor: pointer;
}

.disposition { display: flex; min-height: calc(100vh - 69px); }

nav.menu {
    width: 220px; background: var(--navy-clair); border-right: 1px solid var(--bordure);
    padding: 16px 0; flex-shrink: 0; overflow: hidden; white-space: nowrap;
    transition: width 0.15s ease, padding 0.15s ease;
}
html.menu-reduit nav.menu { width: 0; padding: 0; border-right: none; }

.entete button.bouton-menu {
    background: transparent; border: 1px solid var(--bordure); color: var(--texte);
    padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 1rem; line-height: 1;
}
.entete button.bouton-menu:hover { background: rgba(255,255,255,0.06); }
.menu-logo { display: flex; justify-content: center; padding: 6px 0 20px; }
.menu-logo img { height: 160px; width: 160px; border-radius: 50%; object-fit: cover; }
nav.menu a {
    display: block; padding: 10px 20px; color: var(--texte-attenue); text-decoration: none;
    border-left: 3px solid transparent; font-size: 0.92rem;
}
nav.menu a:hover { background: rgba(255,255,255,0.04); color: var(--texte); }
nav.menu a.actif { border-left-color: var(--coral); color: var(--texte); background: rgba(255,107,94,0.08); font-weight: 600; }

main.contenu { flex: 1; padding: 24px 32px; max-width: 1100px; }
main.contenu-pleine-page {
    padding: 0; max-width: none; display: flex; flex-direction: column;
    min-height: calc(100vh - 69px);
}

h1 { font-size: 1.4rem; margin: 0 0 18px; }
h2 { font-size: 1.1rem; margin: 24px 0 10px; color: var(--texte-attenue); font-weight: 600; }

.carte {
    background: var(--carte); border: 1px solid var(--bordure); border-radius: 10px;
    padding: 18px 20px; margin-bottom: 18px;
}

.etat-badge {
    display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 20px;
    font-weight: 600; font-size: 0.9rem;
}
.etat-badge .point { width: 9px; height: 9px; border-radius: 50%; }
.etat-en_ligne { background: rgba(46,196,182,0.15); color: var(--ok); }
.etat-en_ligne .point { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.etat-demarrage, .etat-arret_en_cours { background: rgba(255,159,69,0.15); color: var(--attention); }
.etat-demarrage .point, .etat-arret_en_cours .point { background: var(--attention); animation: clignote 1.2s infinite; }
.etat-arrete { background: rgba(159,176,204,0.12); color: var(--texte-attenue); }
.etat-arrete .point { background: var(--texte-attenue); }
.etat-echec { background: rgba(255,107,94,0.18); color: var(--danger); }
.etat-echec .point { background: var(--danger); }
@keyframes clignote { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

button, .bouton {
    font: inherit; cursor: pointer; border: none; border-radius: 7px; padding: 9px 16px;
    font-weight: 600; font-size: 0.88rem;
}
.bouton-principal { background: var(--coral); color: #fff; }
.bouton-principal:hover { filter: brightness(1.08); }
.bouton-secondaire { background: transparent; border: 1px solid var(--bordure); color: var(--texte); }
.bouton-danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.bouton-danger:hover { background: rgba(255,107,94,0.1); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

input[type=text], input[type=password], input[type=number], select {
    background: var(--fond); border: 1px solid var(--bordure); color: var(--texte);
    padding: 8px 10px; border-radius: 6px; font: inherit; width: 100%;
}
label { display: block; font-size: 0.85rem; color: var(--texte-attenue); margin-bottom: 5px; }
.champ { margin-bottom: 12px; max-width: 420px; }

table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--bordure); font-size: 0.9rem; overflow-wrap: break-word; }
th { color: var(--texte-attenue); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; }

.table-config th:nth-child(1), .table-config td:nth-child(1) { width: 17%; }
.table-config th:nth-child(2), .table-config td:nth-child(2) { width: 33%; }
.table-config th:nth-child(3), .table-config td:nth-child(3) { width: 30%; }
.table-config th:nth-child(4), .table-config td:nth-child(4) { width: 20%; }
.table-config input, .table-config select { width: 100%; min-width: 0; }

.table-commandes th:nth-child(1), .table-commandes td:nth-child(1) { width: 13%; }
.table-commandes th:nth-child(2), .table-commandes td:nth-child(2) { width: 10%; }
.table-commandes th:nth-child(3), .table-commandes td:nth-child(3) { width: 32%; }
.table-commandes th:nth-child(4), .table-commandes td:nth-child(4) { width: 35%; }
.table-commandes th:nth-child(5), .table-commandes td:nth-child(5) { width: 10%; }

details.categorie-commandes {
    border: 1px solid var(--bordure); border-radius: 8px; margin-bottom: 12px; overflow: hidden;
}
details.categorie-commandes summary {
    cursor: pointer; padding: 12px 16px; background: var(--carte); font-weight: 700;
    color: var(--coral); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em;
    list-style: none;
}
details.categorie-commandes summary::-webkit-details-marker { display: none; }
details.categorie-commandes summary::before { content: '▸ '; }
details.categorie-commandes[open] summary::before { content: '▾ '; }
details.categorie-commandes > div { background: var(--fond); padding: 10px 16px; }
.carte-commande { margin-bottom: 10px; }

.console {
    background: #0a1120; border: 1px solid var(--bordure); border-radius: 8px; padding: 12px 14px;
    font-family: "Cascadia Code", Consolas, monospace; font-size: 0.82rem; overflow-y: auto;
    white-space: pre-wrap; word-break: break-word;
}
.console .ligne { padding: 1px 0; }
.console .inf { color: #9fb0cc; }
.console .wrn { color: var(--orange); }
.console .err { color: var(--coral); }
.console .cmd { color: var(--teal); font-weight: 600; }
.console .join { color: #7ce38b; }
.console .leave { color: #ffd166; }

.msg { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 0.9rem; }
.msg-erreur { background: rgba(255,107,94,0.12); color: var(--danger); border: 1px solid rgba(255,107,94,0.35); }
.msg-ok { background: rgba(46,196,182,0.12); color: var(--ok); border: 1px solid rgba(46,196,182,0.35); }

.pastille-source { display: inline-block; font-size: 0.72rem; padding: 2px 8px; border-radius: 10px; background: rgba(255,255,255,0.06); color: var(--texte-attenue); margin-left: 6px; }
.pastille-live { background: rgba(46,196,182,0.15); color: var(--ok); }

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-carte { width: 340px; text-align: center; }
.login-carte img.logo { height: 220px; width: 220px; border-radius: 50%; object-fit: cover; margin-bottom: 10px; }
.login-carte h1 { font-size: 1.2rem; }
.login-carte form { text-align: left; margin-top: 18px; }
