/* Couleurs de l'application, par-dessus Pico CSS */
:root {
    --app-navy: #0f2a4a;
    --app-blue: #2a78d6;
    --app-blue-dark: #1c5cab;
    --app-orange: #eb6834;
    --app-red: #b91c1c;
    --app-bg: #f6f7f9;
    --app-card: #fff;
    --app-border: #e8ebef;
    --app-muted: #6b7280;
    --app-shadow: 0 1px 3px rgba(15, 42, 74, 0.08);
    --app-radius: 10px;
}

:root[data-theme="light"] {
    --pico-primary: var(--app-blue);
    --pico-primary-background: var(--app-blue);
    --pico-primary-border: var(--app-blue);
    --pico-primary-hover: var(--app-blue-dark);
    --pico-primary-hover-background: var(--app-blue-dark);
    --pico-primary-hover-border: var(--app-blue-dark);
    --pico-primary-focus: rgba(42, 120, 214, 0.3);
    --pico-border-radius: 8px;
    --pico-background-color: var(--app-bg);
}

main.container { padding-top: 1.5rem; padding-bottom: 3rem; }
h1 { font-size: 1.75rem; margin-bottom: 1rem; }
h2 { font-size: 1.25rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.05rem; }
.muted { color: var(--app-muted); }

/* Barre de navigation */
.topbar { background: var(--app-navy); }
.topbar nav { display: flex; align-items: center; gap: 1rem; padding-top: 0.5rem; padding-bottom: 0.5rem; flex-wrap: wrap; }
.topbar nav ul { margin: 0; padding: 0; }
.topbar nav li { padding: 0; margin: 0; list-style: none; }
.topbar nav a, .topbar nav summary { margin: 0; }
.topbar .brand { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 700; color: #fff; text-decoration: none; margin-right: 1rem; }
.brand-ball { display: inline-flex; width: 1.6rem; height: 1.6rem; border-radius: 50%; align-items: center; justify-content: center; font-size: 0.8rem; color: #fff; background: radial-gradient(circle at 35% 30%, #5a9de6, var(--app-blue-dark) 70%); }
.nav-items { display: flex; align-items: center; flex: 1; gap: 1rem; }
.nav-links { display: flex; gap: 0.25rem; flex: 1; }
.nav-links a { display: block; padding: 0.4rem 0.8rem; border-radius: 6px; color: #b9c8db; text-decoration: none; font-size: 0.95rem; margin: 0; }
.nav-links a:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.nav-links a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, 0.15); font-weight: 600; }
.nav-toggle { display: none; margin: 0 0 0 auto; padding: 0.3rem 0.7rem; width: auto; background: transparent; border: 1px solid rgba(255, 255, 255, 0.3); color: #fff; font-size: 1.1rem; line-height: 1; }

/* Menu du compte */
.account-menu { position: relative; margin: 0; }
.account-menu summary { height: auto; line-height: 1.2; display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0.6rem; border-radius: 6px; background: rgba(255, 255, 255, 0.06); color: #d6e2f0 !important; font-size: 0.85rem; cursor: pointer; list-style: none; }
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu summary::after { content: "▾"; float: none; width: auto; height: auto; background: none; transform: none; margin: 0; }
.account-menu[open] summary { background: rgba(255, 255, 255, 0.15); }
.avatar { display: inline-flex; width: 1.6rem; height: 1.6rem; border-radius: 50%; align-items: center; justify-content: center; background: var(--app-orange); color: #fff; font-weight: 700; font-size: 0.8rem; }
.account-menu ul { display: block !important; position: absolute; right: 0; top: calc(100% + 0.4rem); min-width: 12rem; background: var(--app-card); border-radius: var(--app-radius); box-shadow: 0 8px 24px rgba(15, 42, 74, 0.18); padding: 0.4rem 0 !important; z-index: 10; }
.account-menu li { display: block; }
.account-menu li a { display: block; padding: 0.5rem 1rem; color: #1f2937; text-decoration: none; font-size: 0.9rem; margin: 0; }
.account-menu li a:hover { background: #f1f5fb; }
.account-menu li:last-child { border-top: 1px solid var(--app-border); margin-top: 0.3rem; padding-top: 0.3rem; }

@media (max-width: 768px) {
    .nav-toggle { display: block; }
    .nav-items { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 0.5rem; padding-bottom: 0.5rem; }
    .nav-items.open { display: flex; }
    .nav-links { flex-direction: column; align-items: stretch; }
    .nav-links li { text-align: left; }
    .account-menu summary { align-self: flex-start; }
    .hero .balls-lg span { width: 2.3rem; height: 2.3rem; font-size: 0.95rem; margin-right: 0.25rem; }
    .account-menu ul { position: static; box-shadow: none; margin-top: 0.4rem; }
}

/* Cartes : sections des pages */
main > section:not(.hero), main > article { background: var(--app-card); border: 1px solid var(--app-border); border-radius: var(--app-radius); box-shadow: var(--app-shadow); padding: 1.25rem 1.5rem; margin-bottom: 1.5rem; }
main > article > header { margin: -1.25rem -1.5rem 1rem; padding: 0.75rem 1.5rem; background: #f9fafb; border-bottom: 1px solid var(--app-border); border-radius: var(--app-radius) var(--app-radius) 0 0; }

/* Tableaux */
table { background: var(--app-card); border-radius: var(--app-radius); overflow: hidden; }
main > table, .table-scroll { border: 1px solid var(--app-border); box-shadow: var(--app-shadow); }
.table-scroll { overflow-x: auto; border-radius: var(--app-radius); margin-bottom: var(--pico-spacing); background: var(--app-card); }
.table-scroll table { margin: 0; }
th, thead th { background: #f9fafb; color: var(--app-muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
td, th { padding: 0.55rem 0.8rem; }
tbody tr:hover td { background: #f7faff; }

/* Boules */
.balls span { display: inline-flex; width: 2.1rem; height: 2.1rem; align-items: center; justify-content: center; margin-right: 0.3rem; border-radius: 50%; color: #fff; font-weight: 700; font-size: 0.9rem; background: radial-gradient(circle at 35% 30%, #5a9de6, var(--app-blue-dark) 70%); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
.balls span.chance { background: radial-gradient(circle at 35% 30%, #f07272, var(--app-red) 70%); }
.balls-sm span { width: 1.75rem; height: 1.75rem; font-size: 0.78rem; margin-right: 0.2rem; }
.balls-lg span { width: 2.8rem; height: 2.8rem; font-size: 1.1rem; margin-right: 0.4rem; }
td.balls { white-space: nowrap; }

/* Accueil */
.hero { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; flex-wrap: wrap; background: linear-gradient(135deg, var(--app-navy), var(--app-blue-dark)); color: #fff; border-radius: 14px; padding: 1.5rem 1.75rem; margin-bottom: 1.5rem; box-shadow: 0 4px 14px rgba(15, 42, 74, 0.2); }
.hero p { margin: 0; color: inherit; }
.hero-label { color: #b9c8db; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }
.hero-date { font-size: 1.1rem; font-weight: 600; margin: 0.2rem 0 0.8rem; color: #fff; }
.hero-side { text-align: right; color: #d6e2f0; font-size: 0.9rem; line-height: 1.6; display: flex; flex-direction: column; gap: 0.5rem; }
.hero-side strong { color: #fff; font-size: 1.1rem; }
.hero-side small { color: #b9c8db; }
.dot { display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 50%; margin-right: 0.4rem; }
.dot-ok { background: #22c55e; }
.dot-error { background: #ef4444; }
@media (max-width: 768px) { .hero-side { text-align: left; } }

.strategy-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 0.9rem; }
.strategy-card { margin: 0; padding: 0.9rem 1rem; border: 1px solid var(--app-border); border-radius: var(--app-radius); box-shadow: var(--app-shadow); background: var(--app-card); }
.strategy-card header { display: flex; flex-direction: column; align-items: flex-start; gap: 0.3rem; margin: 0 0 0.6rem; padding: 0; background: none; border: 0; font-size: 0.95rem; }
.strategy-line { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.4rem; }
.pool-label { width: 4.5rem; flex-shrink: 0; color: var(--app-muted); font-size: 0.75rem; }

/* Interrupteur Fréquence / Écart actuel */
.color-mode { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.segmented { display: inline-flex; background: #e5e7eb; border-radius: 999px; padding: 3px; }
.segmented a { padding: 0.35rem 1rem; border-radius: 999px; color: #4b5563; text-decoration: none; font-size: 0.9rem; }
.segmented a[aria-current="page"] { background: #fff; color: #111827; font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }

/* Grille des numéros */
.number-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.2rem, 1fr)); gap: 0.45rem; margin-bottom: 1.5rem; }
.number-cell { display: flex; flex-direction: column; align-items: center; padding: 0.55rem 0.25rem; border-radius: 8px; text-decoration: none; font-weight: bold; transition: transform 0.1s ease, box-shadow 0.1s ease; }
.number-cell:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(15, 42, 74, 0.18); text-decoration: none; }
.number-cell small { font-weight: normal; font-size: 0.75rem; }
.heat-0 { background: #eef0f2; color: #333; }
.heat-1 { background: #cde2fb; color: #0d366b; }
.heat-2 { background: #86b6ef; color: #0d366b; }
.heat-3 { background: #3987e5; color: #fff; }
.heat-4 { background: #1c5cab; color: #fff; }
.heat-5 { background: #0d366b; color: #fff; }

/* Statistiques */
.observed { color: var(--app-blue); font-weight: bold; }
.expected { color: var(--app-muted); }
.stat-note { color: var(--app-muted); font-size: 0.85rem; }
details summary { color: var(--app-blue); }

/* Alertes */
.alert { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; border-left: 4px solid currentColor; }
.alert-error { background: #fde8e8; color: #9b1c1c; }
.alert-success { background: #def7ec; color: #03543f; }
.alert-warning { background: #fdf6b2; color: #723b13; }

/* Statuts */
.status { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.status-confirmed, .status-done { background: #def7ec; color: #03543f; }
.status-not_significant, .status-not_validated { background: #f1f2f4; color: #4b5563; }
.status-contaminated { background: #feecdc; color: #8a2c0d; }
.status-untested, .status-pending, .status-running { background: #fdf6b2; color: #723b13; }
.status-failed { background: #fde8e8; color: #9b1c1c; }

/* Connexion */
.login-card { max-width: 28rem; margin: 3rem auto; }

/* Filtre de la page Tirages */
.filter-form { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filter-form label { flex: 0 1 14rem; margin: 0; }
.filter-form input { margin-bottom: 0; }
.filter-form button { width: auto; margin: 0; padding: 0.6rem 1.4rem; }
