/* ==========================================================================
   KINE CONTROL — thème « studio » : chaleureux, doux, vert sauge & crème.
   Typographies auto-hébergées (RGPD) : Fraunces (titres) + Nunito Sans (texte).
   ========================================================================== */

@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/fraunces-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/fraunces-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Nunito Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/nunitosans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Nunito Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/nunitosans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* Crème chaude + vert sauge (le vert de la salle) */
  --bg: #f7f4ec;
  --bg-2: #f2efe4;
  --card: #fffdf8;
  --ink: #33403a;
  --muted: #7d8a7f;
  --primary: #4f7d5d;        /* vert sauge */
  --primary-dark: #35593f;   /* vert forêt profond */
  --accent: #e8efe2;         /* sauge très pâle */
  --accent-warm: #f4ecd9;    /* sable chaud */
  --danger: #b4635a;         /* terracotta doux */
  --border: #e5e1d2;
  --radius: 18px;
  --shadow: 0 4px 18px rgba(78, 96, 74, .08), 0 1px 3px rgba(78, 96, 74, .05);
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  /* Ronds décoratifs du fond */
  --rond-sauge: rgba(143, 173, 138, .38);   /* vert sauge */
  --rond-sable: rgba(214, 189, 131, .26);   /* sable doré chaud */
}
* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  font-size: 16.5px;
  background: linear-gradient(165deg, var(--bg) 0%, var(--bg-2) 55%, var(--bg) 100%);
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
}
/* Deux ronds qui se chevauchent, fixés derrière le contenu */
body::before, body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  z-index: -1;
  pointer-events: none;
  filter: blur(8px);
}
body::before {
  width: 60vmax; height: 60vmax;
  top: -20vmax; right: -14vmax;
  background: radial-gradient(circle at center,
    var(--rond-sauge) 0%, var(--rond-sauge) 56%, transparent 72%);
}
body::after {
  width: 46vmax; height: 46vmax;
  top: -4vmax; right: 10vmax;
  background: radial-gradient(circle at center,
    var(--rond-sable) 0%, var(--rond-sable) 56%, transparent 72%);
}
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid rgba(79, 125, 93, .45); outline-offset: 2px; }

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .5rem;
  background: rgba(255, 253, 248, .82);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  padding: .8rem 1.4rem;
  border-bottom: 1px solid rgba(229, 225, 210, .8);
  position: sticky; top: 0; z-index: 10;
}
.brand {
  font-family: var(--font-display);
  font-weight: 600; font-size: 1.35rem;
  color: var(--primary-dark); letter-spacing: .01em;
}
.brand span { color: var(--primary); font-style: italic; }
.topbar nav { display: flex; align-items: center; gap: .25rem 1.05rem; flex-wrap: wrap; }
.topbar nav a { color: var(--ink); padding: .35rem 0; font-weight: 600; font-size: .95rem; }
.topbar nav a:hover { color: var(--primary-dark); text-decoration: none; }
.nav-user { color: var(--muted); font-size: .9rem; }
.nav-badge { display: inline-block; min-width: 1.2rem; padding: 0 .35rem; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: .72rem; font-weight: 700; text-align: center;
  line-height: 1.2rem; vertical-align: top; }
.btn-nav {
  background: var(--accent); color: var(--primary-dark) !important;
  padding: .45rem 1rem !important; border-radius: 999px; font-weight: 700;
}
.btn-nav:hover { background: #dde8d4; text-decoration: none !important; }

/* Layout */
.container { max-width: 960px; margin: 0 auto; padding: 1.75rem 1.25rem 3rem; }
h1, h2 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--primary-dark);
  letter-spacing: .005em;
  text-wrap: balance;
}
h1 { font-size: 1.85rem; margin: 0 0 1rem; }
h2 { font-size: 1.25rem; margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.hint { font-size: .82rem; color: var(--muted); background: var(--accent-warm); padding: .55rem .8rem; border-radius: 10px; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; margin-bottom: 1.35rem; box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.prose li { margin: .4rem 0; }

/* Hero */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(140deg, #5c8a68 0%, var(--primary-dark) 78%);
  color: #fdfbf5; border-radius: calc(var(--radius) + 8px);
  padding: 3rem 2rem; margin-bottom: 1.6rem;
  box-shadow: 0 14px 34px rgba(53, 89, 63, .22);
}
/* Ronds qui se chevauchent, repris dans le héro */
.hero::before, .hero::after {
  content: ""; position: absolute; border-radius: 50%; pointer-events: none;
  background: rgba(253, 249, 238, .10);
}
.hero::before { width: 19rem; height: 19rem; top: -6.5rem; right: -4.5rem; }
.hero::after { width: 12.5rem; height: 12.5rem; top: -.5rem; right: 4.5rem; background: rgba(253, 249, 238, .08); }
.hero > * { position: relative; z-index: 1; }
.hero h1 {
  font-family: var(--font-display); font-size: 2.15rem; line-height: 1.25;
  color: #fdfbf5; margin-bottom: .6rem;
}
.hero p { max-width: 36rem; opacity: .93; font-size: 1.05rem; }
.hero-cta { margin-top: 1.4rem; display: flex; gap: .75rem; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-block; padding: .62rem 1.25rem; border-radius: 999px; border: 1px solid var(--border);
  background: var(--card); color: var(--ink); font-family: var(--font-body);
  font-size: .95rem; font-weight: 700; cursor: pointer;
  transition: background .15s ease, box-shadow .15s ease, transform .06s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fdfbf5;
  box-shadow: 0 5px 14px rgba(79, 125, 93, .28); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-ghost { background: rgba(255, 253, 248, .9); border-color: var(--primary); color: var(--primary-dark); }
.btn-ghost:hover { background: var(--accent); }
.btn-danger { background: var(--card); border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: .65rem .7rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; }
tbody tr:hover { background: rgba(232, 239, 226, .35); }

/* Forms */
form label { display: block; margin-bottom: .95rem; font-weight: 700; font-size: .9rem; color: var(--primary-dark); }
input, select, textarea {
  width: 100%; padding: .62rem .8rem; border: 1px solid var(--border); border-radius: 12px;
  font-size: 1rem; margin-top: .3rem; background: #fff; color: var(--ink);
  font-family: var(--font-body); font-weight: 400;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--accent); border-color: var(--primary); }
.form-card { max-width: 460px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.checkbox { display: flex; gap: .5rem; align-items: flex-start; font-weight: 400; color: var(--ink); }
.checkbox input { width: auto; margin-top: .25rem; }
.inline-form { display: flex; gap: .5rem; align-items: center; }
.inline-form select { width: auto; min-width: 120px; margin: 0; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0 1rem; align-items: end; }
.grid-form button { margin-bottom: .95rem; }

/* Flash */
.flash { padding: .8rem 1.1rem; border-radius: 14px; margin-bottom: 1.1rem; font-weight: 600; }
.flash-info { background: var(--accent); color: var(--primary-dark); }
.flash-success { background: #e9f2e4; color: #3c6547; border: 1px solid #c2d8b8; }
.flash-error { background: #f7e9e5; color: var(--danger); border: 1px solid #e4c4bd; }

/* Badges */
.badge { display: inline-block; padding: .16rem .6rem; border-radius: 999px; background: var(--accent); color: var(--primary-dark); font-size: .8rem; font-weight: 700; }
.badge-full { background: #f7e9e5; color: var(--danger); }
.badge-mine { background: var(--accent-warm); color: #8a6d3b; }

/* Solde banner */
.solde-banner { background: var(--accent); color: var(--primary-dark); padding: .65rem 1.05rem; border-radius: 12px; margin-bottom: 1.3rem; font-weight: 600; }

/* Course grid */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.course-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.2rem; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease;
}
.course-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(78, 96, 74, .12); }
.course-when { font-size: .8rem; color: var(--primary); font-weight: 700; text-transform: capitalize; letter-spacing: .02em; }
.course-card h3 { margin: .35rem 0; font-size: 1.08rem; font-family: var(--font-display); font-weight: 600; color: var(--ink); }
.course-meta { margin: .6rem 0; display: flex; gap: .4rem; flex-wrap: wrap; }
.course-action { margin-top: auto; }
.course-action form { margin: 0; }
.course-action .btn { width: 100%; }

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin-bottom: 1.3rem; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.15rem; box-shadow: var(--shadow); color: var(--muted); font-size: .85rem; font-weight: 600; }
.stat-num { display: block; font-size: 1.9rem; font-weight: 600; font-family: var(--font-display); color: var(--primary-dark); }

/* Remplissage bar */
.bar { background: var(--border); border-radius: 999px; height: 8px; width: 100px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 999px; }
.bar-fill.bar-high { background: #c98d4b; }
.bar-fill.bar-full { background: var(--danger); }

.back { display: inline-block; margin-bottom: .5rem; font-size: .9rem; font-weight: 600; }

/* Liste des destinataires SMS (diffusion) */
.dest-list { max-height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px;
  padding: .6rem .8rem; margin: .3rem 0 1rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .25rem .8rem; }
.dest-item { margin: 0; padding: .15rem 0; }

/* Fieldset de validité (forfait) */
.validite-fieldset { border: 1px solid var(--border); border-radius: 12px; padding: .5rem 1rem 1rem; margin-bottom: .9rem; }
.validite-fieldset legend { font-weight: 700; font-size: .9rem; color: var(--primary-dark); padding: 0 .4rem; }
.validite-fieldset .checkbox-inline { margin-right: 1.2rem; }
#repeter-box { border-left: 3px solid var(--accent); padding-left: .8rem; margin: .3rem 0 .6rem; }

/* Zone de suppression (fiche patient) */
.danger-zone { border: 1px solid #e4c4bd; background: #fbf3f1; }
.danger-zone h2 { color: var(--danger); }

/* Contact / demande de forfait */
.contact-card { border-left: 4px solid var(--primary); }
.contact-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .75rem; }

/* Badges de paiement */
.badge-paid { background: #e9f2e4; color: #3c6547; }
.badge-due { background: var(--accent-warm); color: #8a6d3b; }

/* Petits boutons & barres de filtre */
.btn-sm { padding: .38rem .8rem; font-size: .85rem; }
.filter-bar { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.checkbox-inline { display: inline-flex; align-items: center; gap: .35rem; font-weight: 400; margin: 0; color: var(--ink); }
.checkbox-inline input { width: auto; margin: 0; }
.wrap-form { flex-wrap: wrap; gap: .6rem; }
.pay-info { font-size: .78rem; margin-bottom: .25rem; }

/* KPI cliquable / alerte */
.stat-link { display: block; color: inherit; }
.stat-link:hover { text-decoration: none; border-color: var(--primary); }
.stat-alert { background: #f9f1df; border-color: #e3ce9d; }
.stat-alert .stat-num { color: #8a6d3b; }

/* Sous-titre & empilement d'actions */
.subhead { font-size: 1rem; margin: 1.3rem 0 .5rem; color: var(--muted); font-weight: 700; }
.action-stack { display: flex; flex-direction: column; gap: .4rem; align-items: flex-start; }

/* Calendrier léger (front planning + back office cours) */
.cal-week-title { font-family: var(--font-display); font-weight: 600; color: var(--primary-dark); font-size: 1rem; margin: 1.3rem 0 .5rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: .45rem; margin-bottom: .5rem; }
.cal-day { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: .4rem; min-height: 84px; display: flex; flex-direction: column; }
.cal-day-empty { background: rgba(255, 253, 248, .45); }
.cal-day-head { display: flex; align-items: baseline; gap: .3rem; margin-bottom: .35rem; font-size: .72rem; color: var(--muted); }
.cal-dow { text-transform: capitalize; }
.cal-dnum { font-weight: 700; color: var(--ink); font-size: .95rem; }
.cal-day-body { display: flex; flex-direction: column; gap: .35rem; }
.cal-evt { display: block; background: var(--accent); border-radius: 8px; padding: .38rem .45rem; font-size: .78rem; color: var(--ink); text-decoration: none; }
.cal-evt:hover { text-decoration: none; filter: brightness(.97); }
.cal-evt-time { font-weight: 700; color: var(--primary-dark); }
.cal-evt-title { font-weight: 600; line-height: 1.2; }
.cal-evt-meta { color: var(--muted); font-size: .72rem; }
.cal-evt.evt-mine { background: var(--accent-warm); }
.cal-evt.evt-hidden { background: #f4ede1; border: 1px dashed #d8cdb2; }
.cal-evt.evt-annule { background: #f7e9e5; text-decoration: line-through; }
.cal-evt form { margin: .3rem 0 0; }
.cal-evt .btn { display: block; width: 100%; text-align: center; padding: .28rem; font-size: .72rem; margin-top: .3rem; }
.cal-act { display: block; text-align: center; font-size: .72rem; margin-top: .3rem; font-weight: 700; }
.cal-full { display: block; text-align: center; color: var(--danger); font-size: .72rem; font-weight: 700; margin-top: .3rem; }
@media (max-width: 760px) {
  .cal-grid { grid-template-columns: 1fr; gap: .3rem; }
  .cal-day { min-height: auto; }
  .cal-day-empty { display: none; }
}

/* Footer */
.footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 2.2rem 1rem; }

@media (prefers-reduced-motion: reduce) {
  .btn, .course-card { transition: none; }
}

@media (max-width: 480px) {
  .hero { padding: 2.2rem 1.4rem; }
  .hero h1 { font-size: 1.6rem; }
  .grid-2 { grid-template-columns: 1fr; }
  .topbar { padding: .6rem .9rem; }
}
