@font-face { font-family: 'Galano'; src: url('polices/GalanoGrotesque-Regular.otf'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Galano'; src: url('polices/GalanoGrotesque-Bold.otf'); font-weight: 700; font-display: swap; }

:root {
  --bg: #f7f5f1; --card: #fff; --ink: #141414; --muted: #7a746b; --line: #e6e1d8; --soft: #efebe4;
  --accent: #F26419; --accent-soft: #fde9de;
  --good: #2f8f5b; --good-bg: #e5f4ea; --ok: #2f6f8f; --ok-bg: #e3eff5;
  --warn: #b7791f; --warn-bg: #fdf3dc; --bad: #c0392b; --bad-bg: #fbe5e1;
  --radius: 14px; --nav-h: 64px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font-family: 'Galano', -apple-system, system-ui, sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 26px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* barre du haut */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 20px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--ink); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { border-radius: 9px; }
.wordmark { font-weight: 700; font-size: 17px; letter-spacing: 0.06em; }
.wordmark b { color: var(--accent); }
.nav { display: flex; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 10px; text-decoration: none; color: #bdb7ad; font-size: 14px; }
.nav a.on { color: #fff; background: #2a2825; }
.nav a.on svg { stroke: var(--accent); }
.nav svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

main { max-width: 980px; margin: 0 auto; padding: 24px 20px 60px; }

@media (max-width: 760px) {
  .topbar { justify-content: center; }
  .nav { position: fixed; bottom: 0; left: 0; right: 0; justify-content: space-around; background: var(--ink); padding: 6px 4px; padding-bottom: max(6px, env(safe-area-inset-bottom)); border-top: 1px solid #2a2825; }
  .nav a { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 8px; }
  .nav a.on { background: none; }
  main { padding: 18px 14px calc(var(--nav-h) + 40px); }
  h1 { font-size: 22px; }
}

/* blocs */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stack { display: grid; gap: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-title { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 26px 0 10px; }

/* boutons & champs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 9px 14px; border-radius: 10px; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: #cfc8bc; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #e05812; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
label.field { display: grid; gap: 5px; font-size: 13px; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { min-height: 70px; resize: vertical; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 13px; font: inherit; font-size: 14px; cursor: pointer; color: var(--ink); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.lv-good { background: var(--good-bg); color: var(--good); }
.lv-ok { background: var(--ok-bg); color: var(--ok); }
.lv-warn { background: var(--warn-bg); color: var(--warn); }
.lv-bad { background: var(--bad-bg); color: var(--bad); }
.lv-unknown { background: var(--soft); color: var(--muted); }
.alert { border-radius: 12px; padding: 12px 14px; font-size: 14px; display: grid; gap: 6px; }
.alert p { margin: 0; }

/* héros accueil */
.hero { background: var(--ink); color: #fff; border-radius: 18px; padding: 22px; display: grid; gap: 14px; position: relative; overflow: hidden; }
.hero .kicker { color: #bdb7ad; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; }
.hero h1 { font-size: 28px; }
.hero .count { font-size: 54px; font-weight: 700; line-height: 1; color: var(--accent); }
.hero .count small { font-size: 16px; color: #bdb7ad; font-weight: 400; margin-left: 6px; }
.hero .meta { display: flex; gap: 22px; flex-wrap: wrap; }
.hero .meta div { display: grid; }
.hero .meta span { font-size: 12px; color: #bdb7ad; }
.hero .meta b { font-size: 18px; }
.hero .ring { position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; border: 26px solid #24221f; border-top-color: var(--accent); transform: rotate(30deg); }
.hero > *:not(.ring) { position: relative; }

/* frise de préparation */
.timeline { display: flex; gap: 3px; margin-top: 4px; }
.timeline i { flex: 1; height: 10px; border-radius: 3px; background: #2a2825; position: relative; }
.timeline i.now { outline: 2px solid #fff; outline-offset: 1px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: #bdb7ad; }
.legend span::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; background: var(--c); vertical-align: -1px; }
.card .legend { color: var(--muted); }

/* séances */
.sess { display: grid; grid-template-columns: 4px 1fr auto; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 12px 12px 0; cursor: pointer; text-align: left; font: inherit; color: inherit; width: 100%; }
.sess:hover { border-color: #cfc8bc; }
.sess .bar { align-self: stretch; border-radius: 0 4px 4px 0; background: var(--c, var(--accent)); }
.sess .t { font-weight: 700; }
.sess .d { font-size: 13px; color: var(--muted); }
.sess.done { opacity: 0.55; }
.sess.done .t { text-decoration: line-through; }
.sess.race { background: var(--accent); border-color: var(--accent); color: #fff; }
.sess.race .d { color: #ffe3d3; }
.sess.race .bar { background: #fff; }
.tag { font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--c, var(--muted)); }
.check { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; background: #fff; cursor: pointer; flex: none; }
.check.on { background: var(--good); border-color: var(--good); }
.check svg { width: 16px; height: 16px; stroke: #fff; fill: none; stroke-width: 3; }

.week-nav { display: flex; align-items: center; gap: 8px; }
.week { display: grid; gap: 10px; }
.day { display: grid; grid-template-columns: 74px 1fr; gap: 12px; align-items: start; }
.day .dl { padding-top: 10px; }
.day .dl b { display: block; font-size: 15px; }
.day .dl span { font-size: 12px; color: var(--muted); }
.day.today .dl b { color: var(--accent); }
.day .list { display: grid; gap: 8px; }
.day .empty { border: 1px dashed var(--line); border-radius: 12px; padding: 12px; color: #b3aca0; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.day .empty button { opacity: 0; }
.day:hover .empty button, .day .empty button:focus { opacity: 1; }
@media (max-width: 760px) { .day { grid-template-columns: 52px 1fr; gap: 8px; } .day .empty button { opacity: 1; } }

.stats { display: flex; gap: 22px; flex-wrap: wrap; }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 12px; color: var(--muted); }

/* courses */
.race-card { display: grid; gap: 12px; }
.race-card .top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.race-card .date { font-size: 13px; color: var(--muted); }
.kv { display: flex; gap: 22px; flex-wrap: wrap; }
.kv div { display: grid; }
.kv span { font-size: 12px; color: var(--muted); }
.kv b { font-size: 17px; }
.race-card.past { opacity: 0.6; }

/* bibliothèque */
.lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.lib .card { cursor: pointer; display: grid; gap: 8px; align-content: start; }
.lib .card:hover { border-color: #cfc8bc; }

/* détails de séance */
.steps { display: grid; gap: 6px; }
.step { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: center; padding: 9px 12px; background: var(--soft); border-radius: 10px; font-size: 14px; }
.step i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.step .p { font-weight: 700; white-space: nowrap; }
.repeat { border: 1.5px solid var(--line); border-radius: 12px; padding: 8px; display: grid; gap: 6px; }
.repeat > .rh { font-size: 12px; font-weight: 700; letter-spacing: 0.05em; color: var(--accent); padding: 0 4px; text-transform: uppercase; }
table.ex { width: 100%; border-collapse: collapse; font-size: 14px; }
table.ex th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.ex td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.ex td:first-child { font-weight: 700; }
table.ex tr:last-child td { border-bottom: 0; }

/* fenêtre */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(620px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: 0 20px 60px rgba(20, 20, 20, 0.25); color: var(--ink); }
dialog::backdrop { background: rgba(20, 20, 20, 0.45); }
#modal-body { padding: 22px; display: grid; gap: 16px; }
.modal-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.x { border: 0; background: var(--soft); border-radius: 50%; width: 32px; height: 32px; cursor: pointer; font-size: 18px; line-height: 1; flex: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 760px) { dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 18px 18px 0 0; max-height: 92vh; } }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 40px); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 14px; opacity: 0; transition: 0.25s; pointer-events: none; z-index: 50; max-width: calc(100vw - 30px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 760px) { #toast { bottom: calc(var(--nav-h) + 24px); } }

.empty-state { text-align: center; padding: 40px 20px; display: grid; gap: 12px; justify-items: center; }
.empty-state img { width: 64px; border-radius: 14px; }
