:root {
    --brand: #7a4f16;
    --brand-light: #f6ede1;
    --border: #e3ddd4;
    --text: #2c2620;
    --muted: #8a8177;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, sans-serif;
    color: var(--text);
    background: #faf8f5;
}

h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h1:focus { outline: none; }
h2 { font-size: 1.1rem; margin: 2rem 0 0.6rem; }

.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--brand);
    color: #fff;
    display: flex;
    flex-direction: column;
}

.brand { font-weight: 700; font-size: 1.1rem; padding: 1.2rem 1rem; }

.sidebar nav { display: flex; flex-direction: column; flex: 1; }

.sidebar nav a {
    color: #f2e5d4;
    text-decoration: none;
    padding: 0.7rem 1rem;
}

.sidebar nav a:hover { background: rgba(255, 255, 255, 0.08); }
.sidebar nav a.active { background: rgba(255, 255, 255, 0.16); color: #fff; font-weight: 600; }

.sidebar-footer { padding: 1rem; font-size: 0.75rem; opacity: 0.6; }

.content { flex: 1; padding: 1.5rem 2rem; max-width: 1100px; }

.cards { display: flex; gap: 1rem; flex-wrap: wrap; }

.card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.4rem;
    min-width: 160px;
    display: flex;
    flex-direction: column;
}

.card-value { font-size: 1.8rem; font-weight: 700; color: var(--brand); }
.card-label { color: var(--muted); font-size: 0.85rem; }

table { border-collapse: collapse; width: 100%; background: #fff; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
th { background: var(--brand-light); font-weight: 600; }
tr:last-child td { border-bottom: none; }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.muted { color: var(--muted); font-size: 0.85rem; }

.filters { display: flex; gap: 0.8rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.filters select { padding: 0.4rem 0.6rem; border: 1px solid var(--border); border-radius: 6px; background: #fff; }

button { cursor: pointer; border-radius: 6px; padding: 0.3rem 0.7rem; font-size: 0.85rem; }
.btn-plain { background: #fff; border: 1px solid var(--border); }
.btn-plain:hover { background: var(--brand-light); }
.btn-danger { background: #c62828; border: 1px solid #c62828; color: #fff; }

#admin-map { height: 70vh; border: 1px solid var(--border); border-radius: 10px; }

.bars .bar-label { width: 60px; color: var(--muted); }
.bars .bar-cell { width: 100%; }
.bars .bar {
    background: var(--brand);
    color: #fff;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    min-height: 1.1rem;
}

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin-bottom: 0.5rem; }
.grid.wide { grid-template-columns: 1fr; }
.grid label { display: flex; flex-direction: column; font-size: 0.85rem; color: var(--muted); gap: 0.2rem; }
.grid input { padding: 0.4rem 0.6rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.95rem; color: var(--text); }
.grid label.check { flex-direction: row; align-items: flex-start; gap: 0.5rem; color: var(--text); }
.grid label.check input { margin-top: 0.15rem; }
/* Paramètre + aide : phrase toujours visible, détails sur demande. */
.param { display: flex; flex-direction: column; gap: 0.25rem; }
.param-hint { font-size: 0.78rem; color: var(--muted); line-height: 1.35; }
.param-more { font-size: 0.78rem; color: var(--muted); }
.param-more summary { cursor: pointer; color: var(--brand); width: fit-content; }
.param-more p { margin: 0.3rem 0 0; padding: 0.5rem 0.6rem; border-left: 3px solid var(--border); line-height: 1.45; }
.group-help { max-width: 60rem; }
.actions { margin: 1.5rem 0; }
.btn-primary { background: var(--brand); color: #fff; border: none; padding: 0.6rem 1.4rem; font-size: 0.95rem; }
.btn-primary:disabled { opacity: 0.5; }
.actions .btn-plain { padding: 0.6rem 1.4rem; font-size: 0.95rem; margin-left: 0.6rem; }
.actions .btn-plain:disabled { opacity: 0.5; }
.badge-ok { background: #e6f4ea; color: #1b5e20; padding: 0.2rem 0.6rem; border-radius: 12px; font-size: 0.8rem; font-weight: 600; }
.badge-wait { background: #fff3cd; color: #7a5c00; padding: 0.2rem 0.6rem; border-radius: 12px; font-size: 0.8rem; font-weight: 600; }
.banner-ok { background: #e6f4ea; color: #1b5e20; padding: 0.7rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.banner-error { background: #fdecea; color: #b71c1c; padding: 0.7rem 1rem; border-radius: 8px; margin-bottom: 1rem; }

/* Mobile : la barre latérale passe en bandeau horizontal en haut, le contenu
   prend toute la largeur et la carte occupe quasiment tout l'écran. */
@media (max-width: 760px) {
    .shell { flex-direction: column; min-height: 100dvh; }

    .sidebar {
        width: 100%;
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
    }
    .brand { padding: 0.8rem 1rem; white-space: nowrap; }
    .sidebar nav { flex-direction: row; flex: 1; }
    .sidebar nav a { padding: 0.8rem 0.9rem; white-space: nowrap; }
    .sidebar-footer { display: none; }

    .content { padding: 1rem; max-width: 100%; }

    #admin-map { height: calc(100dvh - 160px); }
}

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff3cd;
    padding: 0.8rem 1.2rem;
    box-shadow: 0 -1px 6px rgba(0, 0, 0, 0.15);
}

.blazor-error-boundary { background: #b32121; color: #fff; padding: 1rem; }
.blazor-error-boundary::after { content: "Une erreur est survenue."; }

/* Reconnexion Blazor (voir App.razor) : caché par défaut, bandeau pendant les essais. */
#components-reconnect-modal { display: none; }
#components-reconnect-modal.components-reconnect-show {
    display: block; position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    background: #fff3cd; color: #6d4c00; padding: 0.5rem 1rem; text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.badge-banned { background: #fdecea; color: #b71c1c; padding: 0.2rem 0.6rem; border-radius: 12px; font-size: 0.8rem; font-weight: 600; }
tr.selected td { background: #fff8e1; }

/* Connexion */
.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.auth-card { width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 2rem; }
.auth-brand { font-weight: 700; font-size: 1.3rem; color: var(--brand); }
.auth-sub { margin: 0.2rem 0 1.5rem; }
.auth-form { display: flex; flex-direction: column; gap: 0.9rem; }
.auth-form label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); }
.auth-form input, .auth-form select { padding: 0.55rem 0.7rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.95rem; color: var(--text); background: #fff; }
.auth-form .btn-primary { margin-top: 0.4rem; }
.auth-form .validation-errors { color: #b71c1c; font-size: 0.85rem; margin: 0; padding-left: 1.1rem; }

/* Pays et session dans la barre latérale */
.sidebar-country { padding: 0 1rem 1rem; }
.sidebar-country label { display: block; font-size: 0.72rem; opacity: 0.75; margin-bottom: 0.25rem; }
.sidebar-country select { width: 100%; padding: 0.35rem 0.4rem; border-radius: 6px; border: none; font-size: 0.85rem; }
.sidebar-session { padding: 0.6rem 1rem 0; font-size: 0.8rem; display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.sidebar-session button { background: transparent; color: #f2e5d4; border: 1px solid rgba(255, 255, 255, 0.35); }
.country-tag { display: inline-block; background: var(--brand-light); color: var(--brand); border-radius: 12px; padding: 0.15rem 0.7rem; font-size: 0.8rem; font-weight: 600; margin-left: 0.5rem; vertical-align: middle; }
