/* =========================================================
   Oues'Titi Cup — thème Sector Alarm × Koh-Lanta
   ========================================================= */
@font-face { font-family: 'Metric'; src: url('fonts/Metric-Regular.woff2') format('woff2'), url('fonts/Metric-Regular.woff') format('woff'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Metric'; src: url('fonts/Metric-Medium.woff2') format('woff2'), url('fonts/Metric-Medium.woff') format('woff'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Metric'; src: url('fonts/Metric-SemiBold.woff2') format('woff2'), url('fonts/Metric-SemiBold.woff') format('woff'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Metric'; src: url('fonts/Metric-Bold.woff2') format('woff2'), url('fonts/Metric-Bold.woff') format('woff'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Metric'; src: url('fonts/Metric-Black.woff2') format('woff2'), url('fonts/Metric-Black.woff') format('woff'); font-weight: 900; font-display: swap; }

:root {
    --bg: #0d0d0d;
    --bg-2: #171615;
    --bg-3: #221f1c;
    --line: #34302b;
    --text: #f6f2ec;
    --muted: #b1a89c;
    --red: #e30613;
    --red-dark: #a8050f;
    --torch: #f5a524;
    --gold: #ffd34d;
    --silver: #cfd3d8;
    --bronze: #d38a4a;
    --pos: #3ecf72;
    --neg: #ff5a5f;
    --radius: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Metric', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: radial-gradient(1200px 600px at 50% -200px, #2a1a10 0%, transparent 60%), var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding: 12px;
    line-height: 1.45;
    font-size: 15px;
}
a { color: inherit; }
.container { max-width: 900px; margin: 0 auto; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Hero ---------- */
.hero {
    position: relative;
    text-align: center;
    padding: 22px 16px 18px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(0,0,0,.15) 0%, rgba(0,0,0,.55) 100%), url('img/header.jpg') center 35% / cover no-repeat;
    margin-bottom: 14px;
    overflow: hidden;
}
.hero-actions { position: absolute; top: 12px; right: 12px; display: flex; gap: 6px; }
.pill {
    padding: 7px 14px; border-radius: 999px; background: rgba(0,0,0,.55); color: #fff;
    font-size: .8em; font-weight: 600; text-decoration: none; backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,.15);
}
.pill:hover { background: rgba(0,0,0,.75); }
.hero-logo { height: 40px; width: auto; border-radius: 4px; margin-bottom: 8px; }
.hero-title {
    font-size: 2em; font-weight: 900; letter-spacing: .5px; text-transform: uppercase;
    color: #fff; line-height: 1.05;
    text-shadow: 0 2px 0 var(--red-dark), 0 0 18px rgba(245,165,36,.45), 0 4px 14px rgba(0,0,0,.9);
}
.hero-sub { margin-top: 6px; font-size: .85em; font-weight: 600; color: #fff; text-shadow: 0 1px 6px #000, 0 0 2px #000; }

/* ---------- Tabs & chips ---------- */
.tabs { display: flex; gap: 6px; background: var(--bg-2); padding: 5px; border-radius: 16px; border: 1px solid var(--line); margin-bottom: 10px; }
.tab {
    flex: 1; text-align: center; padding: 10px 6px; border-radius: 12px; text-decoration: none;
    font-size: .78em; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted);
}
.tab.active { background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%); color: #fff; box-shadow: 0 4px 14px rgba(227,6,19,.35); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin: 0 0 14px; }
.chip {
    min-width: 44px; padding: 7px 12px; border-radius: 10px; text-align: center; text-decoration: none;
    background: var(--bg-2); border: 1px solid var(--line); color: var(--muted);
    font-size: .8em; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; justify-content: center;
}
.chip.active { background: var(--red); border-color: var(--red); color: #fff; }
.chips.days { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; padding-bottom: 2px; scrollbar-width: none; }
.chips.days::-webkit-scrollbar { display: none; }
.chips.days .chip { flex-direction: column; gap: 0; padding: 6px 10px; flex: 1 0 auto; }
.chips.days .chip small { font-weight: 500; font-size: .85em; opacity: .85; }
.chips.days .chip.weekend:not(.active) { border-style: dashed; }
.chips.days .chip.today:not(.active) { border-color: var(--torch); color: var(--torch); }
.dot-live { width: 7px; height: 7px; border-radius: 50%; background: var(--torch); box-shadow: 0 0 8px var(--torch); animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: .35; } }

.section-title { text-align: center; margin: 6px 0 12px; }
.section-title h2 { font-size: 1.15em; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; }
.section-title p { color: var(--muted); font-size: .82em; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .72em; font-weight: 700; vertical-align: middle; }
.badge-live { background: rgba(245,165,36,.15); color: var(--torch); border: 1px solid rgba(245,165,36,.4); }
.badge-muted { background: var(--bg-3); color: var(--muted); }

/* ---------- Tribus (classement agences) ---------- */
.tribes { display: grid; gap: 10px; }
.tribe {
    --tribe: var(--red);
    background: linear-gradient(90deg, color-mix(in srgb, var(--tribe) 16%, transparent) 0%, var(--bg-2) 45%);
    border: 1px solid var(--line); border-left: 5px solid var(--tribe);
    border-radius: var(--radius); overflow: hidden;
}
.tribe > summary { list-style: none; cursor: pointer; padding: 12px 14px; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.tribe > summary::-webkit-details-marker { display: none; }
.rank {
    width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
    font-weight: 900; font-size: 1.05em; background: var(--bg-3); border: 2px solid var(--line);
}
.rank.r1 { background: radial-gradient(circle at 30% 30%, #fff3b0, var(--gold) 55%, #b8860b); color: #3a2a00; border-color: #ffe27a; box-shadow: 0 0 16px rgba(255,211,77,.45); }
.rank.r2 { background: radial-gradient(circle at 30% 30%, #fff, var(--silver) 55%, #8c9196); color: #222; border-color: #e7e9ec; }
.rank.r3 { background: radial-gradient(circle at 30% 30%, #ffd2a8, var(--bronze) 55%, #8a5221); color: #2b1606; border-color: #e7a46c; }
.tribe-name { font-weight: 800; font-size: 1.08em; }
.tribe-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--muted); font-size: .8em; margin-top: 2px; }
.tribe-meta b { color: var(--text); font-weight: 700; }
.tribe-pts { text-align: right; }
.tribe-pts .big { font-size: 1.7em; font-weight: 900; line-height: 1; }
.tribe-pts small { display: block; color: var(--muted); font-size: .72em; font-weight: 600; }
.chev { display: inline-block; transition: transform .2s; margin-left: 4px; color: var(--muted); font-size: .8em; }
.tribe[open] > summary .chev { transform: rotate(180deg); }
.tribe-body { padding: 0 14px 14px; display: grid; gap: 12px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 3px 9px; border-radius: 999px; font-size: .74em; font-weight: 700; background: var(--bg-3); border: 1px solid var(--line); }
.tag.good { color: var(--pos); border-color: rgba(62,207,114,.4); }
.tag.bad { color: var(--neg); border-color: rgba(255,90,95,.4); }
.tag.warn { color: var(--torch); border-color: rgba(245,165,36,.4); }

.lines { display: grid; gap: 4px; background: rgba(0,0,0,.25); border-radius: 10px; padding: 8px 10px; }
.line { display: flex; justify-content: space-between; gap: 10px; font-size: .86em; }
.line .motif { color: var(--muted); font-size: .9em; display: block; }
.line.empty { color: var(--muted); justify-content: center; }
.pos { color: var(--pos); } .neg { color: var(--neg); } .zero { color: var(--muted); }
.line .pts { font-weight: 800; white-space: nowrap; }

.progress { height: 8px; background: var(--bg-3); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--tribe), var(--torch)); border-radius: 99px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: 10px; }
table.grid { width: 100%; border-collapse: collapse; font-size: .85em; }
table.grid th { text-align: center; color: var(--muted); font-weight: 700; font-size: .78em; text-transform: uppercase; letter-spacing: .3px; padding: 7px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid td { text-align: center; padding: 8px 6px; border-bottom: 1px solid rgba(52,48,43,.6); font-variant-numeric: tabular-nums; }
table.grid th:first-child, table.grid td.name { text-align: left; }
table.grid td.name { font-weight: 700; white-space: nowrap; }
table.grid td.strong { font-weight: 900; }
table.grid tr.top td { background: rgba(245,165,36,.07); }
table.grid tr.team-row td { background: color-mix(in srgb, var(--tribe, var(--red)) 18%, #000); color: var(--text); border-bottom: 1px solid color-mix(in srgb, var(--tribe, var(--red)) 45%, transparent); padding-top: 9px; padding-bottom: 9px; }
table.grid tr.team-row td.name { font-weight: 800; }
table.grid tr.in-team td.name { padding-left: 16px; }
table.grid tr.in-team { display: none; }
table.grid tr.in-team.show { display: table-row; }
table.grid tr.team-row { cursor: pointer; user-select: none; }
table.grid tr.team-row:hover td { filter: brightness(1.25); }
table.grid tr.team-row .chev { margin: 0 4px 0 0; font-size: .75em; display: inline-block; transform: rotate(-90deg); transition: transform .2s; }
table.grid tr.team-row[aria-expanded="true"] .chev { transform: rotate(0); }
.team-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 6px 0 2px; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--tribe, var(--red)) 18%, #000); border: 1px solid color-mix(in srgb, var(--tribe, var(--red)) 40%, transparent); font-size: .88em; }
.team-block { margin-bottom: 6px; }
.team-block > summary { list-style: none; cursor: pointer; }
.team-block > summary::-webkit-details-marker { display: none; }
.team-block .chev { margin-left: 6px; transform: rotate(-90deg); }
.team-block[open] .chev { transform: rotate(0); }
.team-block[open] > .fsr-list { margin: 8px 0 10px; }
.team-head b { font-weight: 800; }
.team-head span { color: var(--muted); }
.cell-sub { display: block; font-size: .78em; color: var(--muted); font-weight: 500; }
.agency-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.fire { filter: drop-shadow(0 0 4px rgba(245,165,36,.7)); }

.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.card h3 { font-size: .9em; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }

/* ---------- Journal du conseil ---------- */
.journal-week { margin-bottom: 16px; }
.journal-week h3 { font-size: .85em; text-transform: uppercase; color: var(--muted); letter-spacing: .6px; margin: 0 0 8px 4px; }
.jentry { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; background: var(--bg-2); border: 1px solid var(--line); border-left: 4px solid var(--tribe, var(--red)); border-radius: 12px; padding: 11px 13px; margin-bottom: 8px; }
.jentry .icon { font-size: 1.5em; }
.jentry .what { font-size: .76em; color: var(--muted); text-transform: uppercase; font-weight: 700; letter-spacing: .3px; }
.jentry .who { font-weight: 800; }
.jentry .motif { font-size: .86em; color: var(--muted); }
.jentry .pts { font-weight: 900; font-size: 1.3em; }

/* ---------- Boutons & formulaires ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 16px; border-radius: 10px; border: 1px solid transparent; cursor: pointer;
    font: inherit; font-weight: 700; font-size: .88em; text-decoration: none;
    background: linear-gradient(135deg, var(--red), var(--red-dark)); color: #fff;
}
.btn:hover { filter: brightness(1.1); }
.btn-ghost { background: var(--bg-3); border-color: var(--line); color: var(--text); }
.btn-sm { padding: 6px 10px; font-size: .8em; border-radius: 8px; }
.btn-danger { background: #5b0a0e; border-color: var(--red); }
.btn-block { width: 100%; }
.share-btn { position: sticky; bottom: 12px; width: 100%; margin-top: 16px; padding: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.6); }

label { display: block; font-size: .8em; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
input[type=text], input[type=number], input[type=password], input[type=date], select, textarea {
    min-height: 44px;
    width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
    background: var(--bg); color: var(--text); font: inherit; font-size: 16px;
}
input[type=color] { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); padding: 3px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--torch); outline-offset: -1px; }
.form-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; }
.form-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form-row > * { flex: 1 1 120px; }
.form-row > .btn, .form-row > input[type=color] { flex: 0 0 auto; }
.hint { font-size: .78em; color: var(--muted); margin-top: 6px; }

.alert { padding: 11px 14px; border-radius: 10px; margin-bottom: 12px; font-weight: 600; font-size: .9em; }
.alert-success { background: rgba(62,207,114,.12); border: 1px solid rgba(62,207,114,.4); color: #8ff0b2; }
.alert-error { background: rgba(255,90,95,.12); border: 1px solid rgba(255,90,95,.4); color: #ffb3b5; }
.alert-warn { background: rgba(245,165,36,.12); border: 1px solid rgba(245,165,36,.4); color: #ffd28a; }

/* ---------- Admin ---------- */
.admin-nav { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; padding-bottom: 2px; scrollbar-width: none; }
.admin-nav::-webkit-scrollbar { display: none; }
.admin-nav a { flex: 0 0 auto; padding: 8px 12px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); text-decoration: none; font-size: .82em; font-weight: 700; color: var(--muted); }
.admin-nav a.active { background: var(--red); border-color: var(--red); color: #fff; }

.ctx { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 2px 2px 10px; }
.ctx h2 { font-size: 1.05em; font-weight: 800; }
.ctx small { color: var(--muted); }

.fsr-card { background: rgba(0,0,0,.28); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.fsr-card.absent { opacity: .6; }
.fsr-card.leader { border-color: rgba(255,211,77,.45); background: linear-gradient(180deg, rgba(255,211,77,.07), rgba(0,0,0,.28)); }
.fsr-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.fsr-head .n { font-weight: 800; }
.fsr-head .s { font-size: .76em; color: var(--muted); }
.counter-grid { display: grid; grid-template-columns: 48px 1fr 1fr; gap: 6px 8px; align-items: center; }
.counter-grid .h { font-size: .7em; color: var(--muted); font-weight: 700; text-align: center; text-transform: uppercase; }
.counter-grid .t { font-weight: 800; font-size: .85em; }
.counter { display: grid; grid-template-columns: 36px 1fr 36px; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.counter button { height: 36px; border: 0; background: var(--bg-3); color: var(--text); font-size: 1.2em; font-weight: 800; cursor: pointer; touch-action: manipulation; }
.counter button:active { background: var(--red); }
.counter button.plus { color: var(--pos); }
.counter button.minus { color: var(--neg); }
.counter output { text-align: center; font-weight: 900; font-size: 1.05em; font-variant-numeric: tabular-nums; }
.counter output.nz { color: var(--torch); }
.counter.busy { opacity: .5; }

.toggle { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .8em; font-weight: 700; color: var(--muted); margin: 0; user-select: none; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle .sw { width: 42px; height: 24px; border-radius: 99px; background: var(--bg-3); border: 1px solid var(--line); position: relative; transition: .2s; flex: 0 0 auto; }
.toggle .sw::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: .2s; }
.toggle input:checked + .sw { background: rgba(62,207,114,.25); border-color: var(--pos); }
.toggle input:checked + .sw::after { left: 20px; background: var(--pos); }
.toggle.danger input:checked + .sw { background: rgba(255,90,95,.25); border-color: var(--neg); }
.toggle.danger input:checked + .sw::after { background: var(--neg); }

.fsr-list { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.saved { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%) translateY(80px); background: #0f2a19; color: #9ef0bd; border: 1px solid var(--pos); padding: 9px 16px; border-radius: 999px; font-weight: 700; font-size: .85em; transition: transform .25s; z-index: 50; }
.saved.show { transform: translateX(-50%) translateY(0); }
.saved.err { background: #2a0f10; color: #ffb3b5; border-color: var(--neg); }

table.list { width: 100%; border-collapse: collapse; font-size: .85em; }
table.list td, table.list th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.list th { color: var(--muted); font-size: .78em; text-transform: uppercase; }
tr.undone td { opacity: .45; text-decoration: line-through; }
tr.undone td:last-child { text-decoration: none; }

.login-box { max-width: 380px; margin: 30px auto; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-bottom: 12px; }
.kpi { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.kpi b { display: block; font-size: 1.4em; font-weight: 900; }
.kpi small { font-size: .6em; font-weight: 700; }
.kpi span { color: var(--muted); font-size: .78em; font-weight: 600; }
table.list a { text-decoration: none; }
table.list a:hover { text-decoration: underline; }
.is-admin .hero { padding: 12px 120px 12px 16px; text-align: left; background-position: center 30%; }
.is-admin .hero-logo { display: none; }
.is-admin .hero-title { font-size: 1.3em; }
.is-admin .hero-sub { margin-top: 2px; font-size: .78em; }
.is-admin .hero-actions { top: 50%; transform: translateY(-50%); }
.foot { text-align: center; color: #5c554c; font-size: .75em; margin: 28px 0 12px; }

@media (max-width: 520px) {
    body { padding: 8px; font-size: 14px; }
    .hero-title { font-size: 1.55em; }
    .hero { padding-top: 46px; }
    .tribe > summary { gap: 10px; padding: 11px 12px; }
    .tribe-pts .big { font-size: 1.5em; }
    table.grid { font-size: .8em; }
    table.grid th, table.grid td { padding: 7px 4px; }
    .hide-sm { display: none; }
}
