:root {
    --bg: #14171c;
    --card: #1d2128;
    --line: #2c323c;
    --text: #e4e7ec;
    --muted: #8b93a1;
    --primary: #4f8cff;
    --ok: #3fb67a;
    --warn: #e0a83a;
    --error: #e5534b;
    --dlc: #b48cff;
    --on-primary: #fff;
    --code-bg: #0c0e11;
    --hover: rgba(255, 255, 255, .03);
    --shadow: rgba(0, 0, 0, .45);
    --backdrop: rgba(8, 10, 13, .7);
    --logo-filter: none; /* logo blanc : assombri sur les thèmes clairs */
    --radius: 8px;
    color-scheme: dark;
}

/* Thèmes (choisis dans « Mon compte », enregistrés par compte). Sombre = valeurs par défaut ci-dessus */
:root[data-theme="light"] {
    --bg: #f3f5f8;
    --card: #ffffff;
    --line: #d9dee6;
    --text: #1d2128;
    --muted: #5f6878;
    --primary: #2f6fe4;
    --ok: #23885a;
    --warn: #a86c00;
    --error: #c93a32;
    --dlc: #7c4dd6;
    --code-bg: #eef1f5;
    --hover: rgba(0, 0, 0, .03);
    --shadow: rgba(20, 30, 50, .18);
    --backdrop: rgba(20, 25, 35, .45);
    --logo-filter: brightness(0) opacity(.85);
    color-scheme: light;
}
/* Indigo : bleu nuit, accents violets et verts, coins arrondis, halo violet en haut de page */
:root[data-theme="indigo"] {
    --bg: #17162a;
    --card: #1f1e33;
    --line: #2d2b42;
    --text: #ecebf5;
    --muted: #8e8ba9;
    --primary: #6c5ce7;
    --link: #a99dff; /* plus clair que --primary, lisible sur les cartes */
    --ok: #5fdd8f;
    --warn: #f2b84b;
    --error: #f0616d;
    --dlc: #b69cff;
    --code-bg: #12111b;
    --hover: rgba(108, 92, 231, .06);
    --shadow: rgba(5, 4, 15, .6);
    --backdrop: rgba(10, 9, 20, .7);
    --radius: 12px;
}
:root[data-theme="indigo"] body {
    background:
        radial-gradient(ellipse 70% 45% at 25% -5%, rgba(108, 92, 231, .38), transparent 70%),
        radial-gradient(ellipse 50% 35% at 90% 0%, rgba(95, 221, 143, .06), transparent 70%),
        var(--bg) fixed;
    min-height: 100vh;
}
:root[data-theme="indigo"] .top { background: rgba(29, 28, 43, .5); backdrop-filter: blur(8px); }
:root[data-theme="indigo"] .card {
    background: linear-gradient(180deg, rgba(108, 92, 231, .07), transparent 140px), var(--card);
    box-shadow: 0 10px 30px var(--shadow);
}
:root[data-theme="indigo"] .btn.primary { box-shadow: 0 4px 16px color-mix(in srgb, var(--primary) 40%, transparent); }
:root[data-theme="indigo"] .badge.ok { background: var(--ok); color: #0f2a1a; }

/* Ardoise : gris ardoise, accents turquoise, en-tête plus sombre, ombres douces */
:root[data-theme="ardoise"] {
    --bg: #1d2024;
    --card: #25292e;
    --line: #32373e;
    --text: #e9ecef;
    --muted: #949ba5;
    --primary: #1db592;
    --on-primary: #ffffff;
    --ok: #22c39d;
    --warn: #e8b84a;
    --error: #d9534f;
    --dlc: #a993f0;
    --code-bg: #17191c;
    --hover: rgba(255, 255, 255, .04);
    --shadow: rgba(10, 12, 15, .45);
    --backdrop: rgba(15, 17, 20, .7);
    --radius: 8px;
}
:root[data-theme="ardoise"] body {
    background:
        radial-gradient(ellipse 90% 50% at 50% 0%, rgba(29, 181, 146, .12), transparent 70%),
        var(--bg) fixed;
    min-height: 100vh;
}
:root[data-theme="ardoise"] .top { background: #16181b; border-bottom-color: #121416; box-shadow: 0 4px 16px var(--shadow); }
:root[data-theme="ardoise"] #tabs button { border-radius: 6px 6px 0 0; border-bottom: 3px solid transparent; }
:root[data-theme="ardoise"] #tabs button.active { background: var(--card); color: var(--primary); border-bottom-color: var(--primary); }
:root[data-theme="ardoise"] .card { border-color: transparent; box-shadow: 0 8px 24px var(--shadow); }
:root[data-theme="ardoise"] .btn { background: #30353c; }
:root[data-theme="ardoise"] .btn.primary { background: linear-gradient(135deg, #22c39d, #12907a); }
:root[data-theme="ardoise"] .btn.danger { background: transparent; }
:root[data-theme="ardoise"] .btn.danger-fill { background: var(--error); }
:root[data-theme="ardoise"] input, :root[data-theme="ardoise"] select { background: #17191c; border-color: #17191c; }
:root[data-theme="ardoise"] th { background: #2e3339; color: var(--text); border-bottom: 0; }
:root[data-theme="ardoise"] th:first-child { border-radius: 6px 0 0 6px; }
:root[data-theme="ardoise"] th:last-child { border-radius: 0 6px 6px 0; }
:root[data-theme="ardoise"] tr.clickable:hover td { background: #2e3339; }

* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--link, var(--primary)); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 18px; margin: 0; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 24px 0 8px; }
main { max-width: 1200px; margin: 0 auto; padding: 16px; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }

/* En-tête */
.top {
    display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
    padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line);
}
#home-link { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 10px; }
.top-logo { height: 32px; width: auto; display: block; filter: var(--logo-filter); }
#tabs { display: flex; gap: 4px; flex: 1; }
#tabs button {
    background: none; border: 0; color: var(--muted); padding: 8px 14px; border-radius: var(--radius);
    cursor: pointer; font: inherit;
}
#tabs button:hover { color: var(--text); }
#tabs button.active { background: var(--line); color: var(--text); }
.logout { display: flex; align-items: center; gap: 8px; color: var(--muted); }

/* Blocs */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
#job { max-width: 1200px; margin: 16px auto 0; scroll-margin-top: 16px; overflow-anchor: none; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 12px; }
.grid div { display: flex; flex-direction: column; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: 4px 0; border-bottom: 1px solid var(--line); }
/* Badge d'état du serveur (En ligne / Arrêté / Démarrage…), plus visible que les autres badges */
#srv-state { font-size: 14px; padding: 5px 16px; }

/* Onglet Serveur (tableau de bord) : colonne d'état à gauche, mission / mods / joueurs à droite */
.dash { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(0, 2.4fr); gap: 12px; align-items: start; }
.dash[hidden] { display: none; }
.dash-side, .dash-main { display: grid; gap: 12px; min-width: 0; }
.dash-card > h3:first-child { margin-top: 0; }
.dash-card .row { margin-bottom: 4px; }
.dash-card p { margin: 4px 0 0; }
.dash-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dash-head h3 { margin: 0; }
.dash-head .btn[hidden] { display: none; }
.dash-head + .dash-mission { margin-top: 10px; }
.dash-state { display: flex; align-items: center; gap: 8px; }
#srv-state[title]:not([title=""]) { cursor: help; }
.dash-section { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.dash-section[hidden] { display: none; }
.dash-name { font-size: 16px; font-weight: 600; margin: 0; }
.dash-meta { font-size: 12px; color: var(--muted); font-family: ui-monospace, Consolas, monospace; margin: 2px 0 0; }
.dash-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.dash-actions .btn { justify-content: center; text-align: center; }
.dash-actions .btn[hidden] { display: none; }
/* Action en cours : aucun bouton, on masque aussi la zone (et son séparateur) */
.dash-actions:not(:has(.btn:not([hidden]))) { display: none; }
.dash-card #srv-hint { margin: 12px 0 0; }
.dash-big { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dash-big small { font-size: 15px; font-weight: 400; color: var(--muted); }
.dash-bar { height: 6px; border-radius: 3px; background: var(--line); margin-top: 8px; overflow: hidden; }
.dash-bar i { display: block; height: 100%; width: 0; background: var(--primary); border-radius: 3px; transition: width .3s; }
.dash-services li { display: flex; justify-content: space-between; gap: 8px; }
.dash-services li:last-child, #srv-players li:last-child { border-bottom: 0; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.error { background: var(--error); }
.dash-mission { font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
.dash-empty { color: var(--muted); font-size: 16px; font-weight: 400; }
@media (max-width: 800px) { .dash { grid-template-columns: minmax(0, 1fr); } }
/* Style « valeurs mises en avant » : titres de bloc discrets, valeurs grandes et en gras */
.dash-card { padding: 16px 18px; border-radius: 10px; }
.dash-card h3 { font-size: 12px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); }
.dash-card #srv-state { font-size: 12px; padding: 3px 11px; }
.dash-name { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.dash-meta { margin-top: 3px; }
.dash-section { margin-top: 14px; padding-top: 14px; }
.dash-actions .btn { padding: 9px 14px; }
.dash-big { font-size: 34px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; margin-top: 6px; }
.dash-big small { font-size: 16px; letter-spacing: 0; }
.dash-bar { height: 5px; margin-top: 12px; }
.dash-services { margin-top: 6px; }
.dash-services li { padding: 6px 0; font-size: 13px; }
.dash-head + .dash-mission { margin-top: 8px; }
.dash-mission { font-size: 21px; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
#srv-mission-sub { font-size: 13px; margin-top: 4px; }
.dash-card .chips { margin-top: 10px; gap: 6px; }
.dash-card .chip { padding: 4px 11px; }
#srv-players { margin-top: 6px; }
#srv-players li.player { padding: 7px 0; }
#srv-players .player-name { font-size: 14px; font-weight: 600; }
#srv-players .player-score { font-size: 15px; font-weight: 700; }
.dash-empty { font-size: 18px; }
.h3-count { text-transform: none; letter-spacing: 0; font-weight: 400; }
/* Joueurs connectés : nom, temps de jeu (petit), score à droite */
#srv-players li.player { display: flex; align-items: baseline; gap: 8px; }
.player-name { font-weight: 500; }
.player-time { font-size: 11px; font-family: ui-monospace, Consolas, monospace; }
.player-score { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Formulaires */
input, select {
    background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 8px 10px; font: inherit; min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.btn {
    background: var(--line); color: var(--text); border: 1px solid transparent; border-radius: var(--radius);
    padding: 8px 14px; font: inherit; cursor: pointer; white-space: nowrap;
}
.btn:hover:not(:disabled) { filter: brightness(1.2); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: var(--on-primary); }
.btn.danger { background: transparent; border-color: var(--error); color: var(--error); }
.btn.small { padding: 4px 10px; font-size: 12px; }
body.busy [data-needs-idle], body.busy #btn-update, body.busy #btn-start, body.busy #btn-mods-update-all,
body.busy #form-add button { pointer-events: none; opacity: .4; }
/* Serveur démarré : pas de mise à jour de mod ni de déploiement de mission */
body.srv-running [data-needs-stopped] { pointer-events: none; opacity: .4; }
.running-only { display: none; }
body.srv-running .running-only { display: block; }

/* Badges et pastilles */
.badge {
    display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600;
    background: var(--line); color: var(--muted); white-space: nowrap;
}
.badge.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.badge.warn { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.badge.error { background: color-mix(in srgb, var(--error) 15%, transparent); color: var(--error); }
.badge.admin { background: color-mix(in srgb, var(--error) 15%, transparent); color: var(--error); }
.badge.live { background: color-mix(in srgb, var(--primary) 18%, transparent); color: var(--primary); }
.badge.dlc { background: color-mix(in srgb, var(--dlc) 18%, transparent); color: var(--dlc); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    background: var(--line); border: 0; color: var(--text); padding: 4px 10px; border-radius: 99px; font: inherit; font-size: 12px;
}
button.chip { cursor: pointer; }
/* Mod épinglé : même icône que l'onglet Mods, en rouge */
.chip svg { width: 12px; height: 12px; margin-right: 4px; vertical-align: -1px; color: var(--error); }
.chip.dlc { background: color-mix(in srgb, var(--dlc) 18%, transparent); color: var(--dlc); }
.chip.missing { color: var(--error); text-decoration: line-through; }
.alert { padding: 10px 12px; border-radius: var(--radius); margin: 12px 0; }
.alert.error { background: color-mix(in srgb, var(--error) 15%, transparent); color: var(--error); }
.alert.warn { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }

/* Tableaux */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
tr.on td:nth-child(2) { font-weight: 600; }
td.actions { text-align: right; white-space: nowrap; }
tr.group td {
    padding-top: 24px; color: var(--muted); font-size: 12px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .05em;
}
tr.group:first-child td { padding-top: 8px; }
tr.group.pinned td { color: var(--error); border-bottom-color: color-mix(in srgb, var(--error) 40%, transparent); }
tr.group.mods td { color: var(--ok); border-bottom-color: color-mix(in srgb, var(--ok) 40%, transparent); }
tr.group.dlc td { color: var(--dlc); border-bottom-color: color-mix(in srgb, var(--dlc) 40%, transparent); }
/* Titres de section de l'onglet Missions, même style que les groupes de mods */
h3.section { padding-bottom: 6px; border-bottom: 1px solid var(--line); }
h3.section.pending { color: var(--warn); border-bottom-color: color-mix(in srgb, var(--warn) 40%, transparent); }
h3.section.deployed { color: var(--ok); border-bottom-color: color-mix(in srgb, var(--ok) 40%, transparent); }
td.actions .btn + .btn { margin-left: 4px; }
td.actions input { padding: 4px 8px; font-size: 12px; width: 200px; }
td select { padding: 4px 8px; font-size: 12px; }
.icon-btn {
    background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 13px;
    padding: 2px 8px; border-radius: var(--radius); opacity: .5;
}
.icon-btn:hover { color: var(--error); background: color-mix(in srgb, var(--error) 12%, transparent); opacity: 1; }
#audit-table tr:hover .icon-btn { opacity: 1; }
.pin { background: none; border: 0; cursor: pointer; opacity: .2; padding: 0 4px; font-size: 12px; }
.pin.on, .pin:hover { opacity: 1; }
/* Icônes SVG : grises si inactives, colorées si actives (épinglé = rouge, masqué = orange) */
.pin.icon-pin, .pin.icon-eye { color: var(--muted); opacity: .6; vertical-align: middle; line-height: 0; }
.pin.icon-pin:hover, .pin.icon-eye:hover { opacity: 1; color: var(--text); }
.pin.icon-pin.on { color: var(--error); opacity: 1; }
/* Icônes collées au nom ; l'espace libre de la ligne va après elles, ce qui pousse les dates vers la droite */
td.mod-opts { white-space: nowrap; width: 15%; padding-left: 0; }
#mods-table td.actions { width: 1%; }
/* Liste des mods : dates (installé, Workshop) et taille en petit, dossier grisé sous la date d'installation */
#mods-table td:nth-child(4), #mods-table td:nth-child(5), #mods-table td:nth-child(6) { font-size: 12px; white-space: nowrap; }
#mods-table tbody td:nth-child(2) { min-width: 220px; } /* nom : rarement sur 2 lignes */
/* Tout est centré verticalement ; le dossier est placé sous la date d'installation sans la décaler,
   pour que les deux dates restent alignées */
#mods-table tbody tr:not(.group) td { height: 56px; }
#mods-table tbody td:nth-child(4) { position: relative; }
#mods-table tbody td:nth-child(4) > div { position: absolute; left: 8px; top: calc(50% + 9px); line-height: 1.2; }
.pin.icon-eye.on { color: var(--warn); opacity: 1; }
.pin.icon-warn { color: var(--warn); opacity: 1; vertical-align: middle; line-height: 0; }

/* Interrupteur */
.switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 99px; cursor: pointer; transition: .15s; }
.switch span::before {
    content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px;
    background: var(--muted); border-radius: 50%; transition: .15s;
}
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(16px); background: #fff; }
.switch input:disabled + span { opacity: .6; cursor: not-allowed; }

/* Tâche en cours */
#job .row { margin-bottom: 8px; }
#job-hint, #srv-hint { margin: 0 0 8px; font-size: 12px; }
.spinner {
    width: 18px; height: 18px; border-radius: 50%; flex: none;
    border: 3px solid color-mix(in srgb, var(--warn) 25%, transparent); border-top-color: var(--warn);
    animation: spin .8s linear infinite;
}
.spinner[hidden] { display: none; }
.spinner.small { width: 14px; height: 14px; border-width: 2px; }
.checking { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.checking[hidden] { display: none; }
.loading-row { padding: 32px 8px; text-align: center; color: var(--muted); }
.grid .loading-row { grid-column: 1 / -1; flex-direction: row; justify-content: center; align-items: center; }
.loading-row .spinner { display: inline-block; vertical-align: middle; margin-right: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.5s; } }
#job-log, .steam-log pre {
    background: var(--code-bg); border-radius: var(--radius); padding: 12px; margin: 0;
    max-height: 320px; overflow: auto; font: 12px/1.4 ui-monospace, Consolas, monospace; white-space: pre-wrap;
}

/* Missions */
.upload-zone {
    display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
    padding: 36px 16px; border: 2px dashed color-mix(in srgb, var(--primary) 55%, transparent); border-radius: 12px;
    background: color-mix(in srgb, var(--primary) 7%, transparent); color: var(--text); cursor: pointer;
    transition: background .15s, border-color .15s;
}
.upload-zone:hover, .upload-zone.over { background: color-mix(in srgb, var(--primary) 14%, transparent); border-color: var(--primary); }
.upload-zone.over { border-style: solid; }
.upload-title { font-size: 18px; }
.upload-btn { margin: 4px 0; pointer-events: none; }
.upload-zone small { max-width: 520px; }

.upload-list { list-style: none; padding: 0; margin: 12px 0 0; }
.upload-list li {
    display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
    padding: 8px 12px; border-radius: var(--radius); background: var(--bg); margin-bottom: 6px;
}
.upload-name { word-break: break-all; }
.upload-status { font-size: 12px; white-space: nowrap; }
.upload-bar { grid-column: 1 / -1; height: 4px; border-radius: 99px; background: var(--line); overflow: hidden; }
.upload-bar-fill { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.upload-list li.ok .upload-status { color: var(--ok); }
.upload-list li.ok .upload-bar-fill { background: var(--ok); }
.upload-list li.error .upload-status { color: var(--error); white-space: normal; }
.upload-list li.error .upload-bar-fill { background: var(--error); width: 100% !important; }
details { margin-top: 24px; }
.steam-log { margin-top: 8px; }
#steam-check-result { margin-top: 12px; }
.deploy-row { margin-top: 16px; }
.admin-box { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 4px 16px 16px; margin-top: 24px; }
.admin-box > h3 { margin-top: 12px; }
summary { cursor: pointer; color: var(--muted); margin-bottom: 12px; }

/* Bandeau des missions en attente */
.banner {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap; width: calc(100% - 32px); max-width: 1200px;
    margin: 16px auto 0; padding: 12px 16px; border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); border-radius: var(--radius);
    background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--warn); font: inherit; text-align: left; cursor: pointer;
}
.banner:hover { background: color-mix(in srgb, var(--warn) 20%, transparent); }
.banner[hidden] { display: none; }
.banner-icon { font-size: 18px; }
.banner-link { font-weight: 600; white-space: nowrap; }
.banner .running-only { color: var(--text); }
body.srv-running .banner .running-only { display: inline; }
.tab-count {
    display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px; border-radius: 99px;
    background: var(--warn); color: #1a1406; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.tab-count[hidden] { display: none; }

/* Mon compte */
#profile-link { text-decoration: none; }
#profile-link.active { background: var(--primary); color: var(--on-primary); }
.profile { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; }
@media (max-width: 800px) { .profile { grid-template-columns: minmax(0, 1fr); gap: 8px; } }
.profile-info { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0 0 16px; }
.profile-info dt { color: var(--muted); }
.profile-info dd { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; max-width: 380px; }
.stack label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); }
.field-error { margin: 0; color: var(--error); font-size: 13px; }
.small { font-size: 12px; margin: 0; }

/* Fenêtre de confirmation */
.modal {
    width: min(440px, calc(100vw - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: 12px;
    background: var(--card); color: var(--text); box-shadow: 0 16px 48px var(--shadow);
}
.modal::backdrop { background: var(--backdrop); backdrop-filter: blur(2px); }
.modal h2 { font-size: 16px; margin: 0 0 12px; }
.modal p { margin: 0 0 24px; line-height: 1.6; color: var(--text); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
/* Fenêtre des dépendances d'un mod */
.deps-modal { width: min(520px, calc(100vw - 32px)); }
.deps-modal p.muted { margin-bottom: 12px; color: var(--muted); }
.deps-list { margin-bottom: 16px; }
.dep-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.dep-row.off { cursor: default; }
.dep-row input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }
.dep-row a { color: var(--text); }
.btn.danger-fill { background: var(--error); color: var(--on-primary); }
.modal[open] { animation: modal-in .15s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .modal[open] { animation: none; } }

/* Notifications */
#toast {
    position: fixed; right: 16px; bottom: 16px; max-width: min(420px, calc(100vw - 32px)); z-index: 10;
    padding: 12px 16px; border-radius: var(--radius); background: var(--card); border-left: 4px solid var(--ok);
    box-shadow: 0 8px 24px var(--shadow); white-space: pre-line;
}
#toast.error { border-left-color: var(--error); }

/* Connexion */
.login {
    /* align-items: stretch : les deux blocs (connexion / dépôt) ont la même hauteur */
    /* Contenu calé en haut (avec un peu d'espace) plutôt que centré verticalement */
    display: flex; flex-wrap: wrap; justify-content: center; align-items: stretch; align-content: flex-start;
    gap: 24px; min-height: 100vh; padding: 6vh 16px 16px;
}
.login-logo { filter: var(--logo-filter); flex-basis: 100%; height: 240px; object-fit: contain; margin-bottom: 2rem; }  /* logo centré, seul sur sa ligne */
.login .login-site { flex-basis: 100%; text-align: center; font-size: 12px; }
.login-site a { color: var(--muted); }
.login-site a:hover { color: var(--text); }
.login form { width: min(360px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 14px; }
.login label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); }
.login h2 { font-size: 18px; margin: 0; }
.login p { margin: 0; }
.login form > .btn { margin-top: auto; }
.login label.check { flex-direction: row; align-items: center; gap: 8px; cursor: pointer; color: var(--text); }
.login label.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }            /* bouton Connexion calé en bas du bloc */
/* Zone de dépôt de la page d'accueil : même style que dans le panel (.upload-zone), en plus compact */
.login .upload-zone { flex: 1; justify-content: center; gap: 8px; padding: 20px 16px; color: var(--text); }
.login .upload-list { margin: 0; }
.login .upload-status { white-space: normal; text-align: right; }

@media (max-width: 700px) {
    .top { gap: 8px; }
    #tabs { order: 3; flex-basis: 100%; overflow-x: auto; }
    main { padding: 8px; }
}

/* Onglet Stats */
.subtabs { display: flex; gap: 4px; }
.subtabs .btn { background: none; color: var(--muted); }
.subtabs .btn.active { background: var(--line); color: var(--text); }
.stats-current {
    display: flex; align-items: center; gap: 10px; width: 100%; margin-bottom: 12px; padding: 10px 12px;
    background: color-mix(in srgb, var(--primary) 12%, transparent); border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent); border-radius: var(--radius);
    color: var(--primary); font: inherit; text-align: left; cursor: pointer;
}
.stats-current:hover { background: color-mix(in srgb, var(--primary) 20%, transparent); }
.stats-current[hidden] { display: none; }
.stats-current .grow { color: var(--text); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex: none; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--hover); }
.pager { margin: 12px 0 0; }
.pager .btn { min-width: 48px; font-size: 16px; padding: 6px 14px; }
.stat-cards { margin-bottom: 16px; }
.grid .stat-card { background: var(--bg); border-radius: var(--radius); padding: 10px 12px; gap: 2px; }
.stat-card strong { font-size: 18px; }
.stat-card small { font-size: 12px; }
#stats-game-title { font-size: 20px; line-height: 1.3; }
#stats-game-title .badge { margin-left: 8px; vertical-align: middle; }
#stats-game-table .badge { margin-left: 8px; }
.bar-col { width: 30%; }
.score-bar { height: 6px; border-radius: 3px; background: var(--primary); }
.stat-icon { width: 20px; height: 20px; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
th.stat-col, td.stat-col { width: 1%; min-width: 36px; padding-left: 6px; padding-right: 6px; text-align: center; }
th.stat-first, td.stat-first { padding-left: 32px; }
#stats-players-table th.num, #stats-players-table td.num { text-align: center; }
#stats-game-table th.score-col, #stats-game-table td.player-score { text-align: center; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sorted { color: var(--text); }
th.sorted::after { content: " ↓"; }
th.sorted.asc::after { content: " ↑"; }
@media (max-width: 800px) { .bar-col { display: none; } }
