/* =============================================================================
   Event Scaler — feuille de style unique.

   Trois couches : les jetons, les éléments de base, puis les composants.
   Aucune ombre portée hors anneau de focus ; les blocs se distinguent par
   l'espace et des filets, pas par de l'élévation. Un seul accent, et des
   couleurs sémantiques réservées à ce qui porte une information.
   ========================================================================== */

/* --- 0. Polices ---------------------------------------------------------- */
/*
   Une seule police est téléchargée, et elle est servie par nos soins.

   L'interface se contente de la police système : à 14 px, un grotesque neutre
   en vaut un autre, et Instrument Sans coûtait trois graisses pour une
   différence qu'on ne voit pas. Le serif, lui, reste — il porte les titres de
   page et les trois grands chiffres, et son repli Georgia a des chiffres
   elzéviriens qui descendent sous la ligne de base : les grands nombres du
   tableau de bord s'afficheraient bancals.

   Hébergée ici plutôt que chez Google : une origine externe de moins, donc un
   DNS et une poignée de main TLS de moins à la première visite, et le fichier
   prend le nom empreinté de `collectstatic` — mis en cache une fois, pour un an.
*/
@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  /* `swap` : le titre s'affiche tout de suite en repli, jamais en blanc. */
  font-display: swap;
  src: url("../fonts/instrument-serif-latin.c008db4e8a97.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Le latin étendu pèse 8 Ko et n'est chargé que si un nom d'événement en a
   besoin. Sans lui, un « Łódź » dans un titre partirait en Georgia au milieu
   d'un mot. */
@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/instrument-serif-latin-ext.18e8ea957b6c.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;
}

/* --- 1. Jetons ----------------------------------------------------------- */
:root {
  --canvas:     #fbfbfa;
  --surface:    #ffffff;
  --sidebar:    #f6f6f4;
  --sunken:     #f4f4f2;

  --ink:        #191b19;
  --ink-2:      #5b615c;
  --ink-3:      #8a908a;
  --ink-4:      #b4b8b3;

  --line:       #e8e8e5;
  --line-2:     #d6d7d2;

  --accent:     #2f6b4f;
  --accent-ink: #26563f;
  --accent-bg:  #edf3ef;

  --ok:         #2f6b4f;
  --ok-bg:      #edf3ef;
  --warn:       #8a5a12;
  --warn-bg:    #fbf2e4;
  --alert:      #a13a2b;
  --alert-bg:   #fbeeeb;
  --info-bg:    #eef1f4;

  --r-control:  6px;
  --r-card:     8px;
  --r-pill:     999px;

  --sans:  ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;

  --sidebar-w: 216px;
}

/* --- 2. Éléments --------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0; font-weight: 500; line-height: 1.2; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.tabular, table, .kpi-value { font-variant-numeric: tabular-nums; }

/* --- 3. Ossature --------------------------------------------------------- */
.app { min-height: 100vh; }

/* Case de commande du tiroir : jamais visible, à aucune taille. */
#drawer { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 12px;
}

.brand {
  font-family: var(--serif);
  font-size: 21px;
  color: var(--ink);
  padding: 0 10px 14px;
  letter-spacing: -.01em;
}
.brand:hover { text-decoration: none; }

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

.nav-item {
  display: block;
  padding: 7px 10px;
  border-radius: var(--r-control);
  color: var(--ink-2);
  font-size: 13.5px;
}
.nav-item:hover { background: rgba(25, 27, 25, .045); color: var(--ink); text-decoration: none; }
.nav-item.is-active { background: var(--surface); color: var(--ink); font-weight: 500; }

.sidebar-foot { margin-top: auto; padding-top: 14px; }

.main { min-width: 0; }
.page { max-width: 1180px; padding: 26px 28px 64px; }

/* --- 4. En-tête de page -------------------------------------------------- */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px 16px;
  margin-bottom: 22px;
}
.page-title {
  font-family: var(--serif);
  font-size: 30px;
  letter-spacing: -.015em;
  text-wrap: balance;
}
.page-sub { color: var(--ink-2); margin-top: 2px; }
.page-head .spacer { margin-left: auto; }

.section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-3);
  font-weight: 500;
}

/* --- 5. Indicateurs ------------------------------------------------------ */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  overflow: hidden;
  margin-bottom: 26px;
}
.kpi { padding: 18px 22px; border-left: 1px solid var(--line); }
.kpi:first-child { border-left: 0; }
.kpi-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-3); font-weight: 500;
}
.kpi-value {
  font-family: var(--serif);
  font-size: 38px;
  line-height: 1.05;
  margin-top: 6px;
  letter-spacing: -.02em;
}
.kpi-note { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }
.kpi-note a { color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; }

/* --- 6. Cartes ----------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}
.card + .card { margin-top: 16px; }
.card-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
}
.card-title { font-size: 14px; font-weight: 500; }
.card-head .spacer { margin-left: auto; }
.card-body { padding: 16px 18px; }
.card-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--sunken);
  border-radius: 0 0 var(--r-card) var(--r-card);
}
/* Carte entièrement cliquable : sur un stand, la cible est la carte, pas le
   titre. L'espacement vertical vient de la grille, jamais de la marge. */
.card--link { display: block; color: inherit; }
.card--link:hover { border-color: var(--accent); text-decoration: none; }
.grid > .card + .card { margin-top: 0; }

.divided > * { border-top: 1px solid var(--line); }
.divided > *:first-child { border-top: 0; }

.empty { padding: 28px 18px; text-align: center; color: var(--ink-3); }

/* --- 7. Tableaux --------------------------------------------------------- */
table { border-collapse: collapse; width: 100%; }
.table th {
  text-align: left;
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-3); font-weight: 500;
  padding: 9px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--sunken);
  white-space: nowrap;
}
.table td { padding: 11px 18px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--sunken); }
.num { text-align: right; }

/* --- 8. Pastilles et puces ----------------------------------------------- */
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--info-bg);
  color: var(--ink-2);
}
.pill--ok    { background: var(--ok-bg);    color: var(--ok); }
.pill--warn  { background: var(--warn-bg);  color: var(--warn); }
.pill--alert { background: var(--alert-bg); color: var(--alert); }
.pill--solid { background: var(--accent); color: #fff; }

/* Statut d'événement : un attribut plutôt qu'une cascade de conditions. */
.pill[data-status="PROPOSED"]    { background: var(--info-bg);  color: var(--ink-2); }
.pill[data-status="CONSIDERING"] { background: var(--warn-bg);  color: var(--warn); }
.pill[data-status="CONFIRMED"]   { background: var(--ok-bg);    color: var(--ok); }
.pill[data-status="READY"]       { background: var(--accent);   color: #fff; }
.pill[data-status="DONE"]        { background: var(--sunken);   color: var(--ink-3); }
.pill[data-status="CANCELLED"],
.pill[data-status="REJECTED"]    { background: var(--alert-bg); color: var(--alert); }

.pill[data-booking="BOOKED"]     { background: var(--ok-bg);    color: var(--ok); }
.pill[data-booking="TO_BOOK"]    { background: var(--warn-bg);  color: var(--warn); }
.pill[data-booking="NOT_NEEDED"] { background: var(--sunken);   color: var(--ink-3); }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 1.5px 7px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-control);
  font-size: 11.5px;
  color: var(--ink-2);
  background: var(--surface);
  white-space: nowrap;
}
.chip--ok    { border-color: #b9d3c5; background: var(--ok-bg);    color: var(--ok); }
.chip--warn  { border-color: #e6cfa4; background: var(--warn-bg);  color: var(--warn); }
.chip--alert { border-color: #e6bdb4; background: var(--alert-bg); color: var(--alert); }
.chip .lvl { color: var(--ink-3); }
.chip--ok .lvl, .chip--warn .lvl, .chip--alert .lvl { color: inherit; opacity: .75; }

/* --- 9. Boutons ---------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 13px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--sunken); text-decoration: none; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn--ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: var(--sunken); color: var(--ink); }
.btn--danger { border-color: #e2bdb5; color: var(--alert); }
.btn--danger:hover { background: var(--alert-bg); }
.btn--sm { padding: 4px 9px; font-size: 12px; }
.btn--lg { padding: 11px 18px; font-size: 15px; }
.btn--block { width: 100%; }

.link-quiet { color: var(--ink-2); }
.link-quiet:hover { color: var(--accent-ink); }

/* --- 10. Formulaires ----------------------------------------------------- */
.field { min-width: 0; }
.field > label, .label {
  display: block;
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-3); font-weight: 500;
  margin-bottom: 4px;
}
input:not([type=checkbox]):not([type=radio]), select, textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-control);
  padding: 7px 10px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 15px; height: 15px; }
textarea { resize: vertical; }
select[multiple] { padding: 4px; }

.helptext { display: block; font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.errorlist { color: var(--alert); font-size: 12px; margin-top: 4px; }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: 13.5px; }
.check input { margin-top: 2px; flex: 0 0 auto; }

fieldset { border: 1px solid var(--line); border-radius: var(--r-card); padding: 14px 16px; margin: 0; }
legend { padding: 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 500; }

/* --- 11. Messages -------------------------------------------------------- */
.notice {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: var(--surface);
  font-size: 13.5px;
}
.notice--success { background: var(--ok-bg);    border-color: #cfe1d7; color: var(--ok); }
.notice--warning { background: var(--warn-bg);  border-color: #ecd9b4; color: var(--warn); }
.notice--error   { background: var(--alert-bg); border-color: #ebc9c1; color: var(--alert); }
/* Le bandeau d'abonnement ouvre la page : il se cale plus haut que le reste du
   contenu, sans quoi il flotte au milieu du blanc au-dessus du titre. */
.notice--banner { margin: -12px 0 18px; }

/* --- 12. Divers ---------------------------------------------------------- */
.progress { height: 4px; background: var(--line); border-radius: var(--r-pill); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: var(--r-pill); }
.progress--warn > span { background: #c08b2e; }

.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-bg); color: var(--accent-ink);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 500;
}

.menu {
  position: absolute; z-index: 40;
  min-width: 210px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-card);
  padding: 4px;
}
.menu a, .menu button {
  display: block; width: 100%; text-align: left;
  padding: 7px 10px; border-radius: var(--r-control);
  font-size: 13.5px; color: var(--ink); background: none; border: 0; cursor: pointer; font-family: inherit;
}
.menu a:hover, .menu button:hover { background: var(--sunken); text-decoration: none; }
.menu .sep { border-top: 1px solid var(--line); margin: 4px 0; }

details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::marker { content: ""; }
.caret { display: inline-block; color: var(--ink-3); transition: transform .12s ease; }
details[open] > summary .caret { transform: rotate(90deg); }

/* --- 13. Utilitaires ----------------------------------------------------- */
.row   { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.row--tight { gap: 6px; }
.row--top { align-items: flex-start; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack--lg { gap: 18px; }
.grid  { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* Colonne principale + colonne latérale. Un `style` en ligne l'emporterait sur
   la requête média : ces proportions doivent vivre dans la feuille. */
.grid--main { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.grid--wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid--auto { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.span-2 { grid-column: span 2; }
.spacer { margin-left: auto; }
.muted { color: var(--ink-2); }
.dim   { color: var(--ink-3); }
.small { font-size: 12.5px; }
.tiny  { font-size: 11.5px; }
.strong { font-weight: 500; }
.serif { font-family: var(--serif); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scroller { overflow-x: auto; }
.rule { border: 0; border-top: 1px solid var(--line); margin: 26px 0; }
.mt-0 { margin-top: 0 } .mt-1 { margin-top: 8px } .mt-2 { margin-top: 16px } .mt-3 { margin-top: 24px }
.mb-1 { margin-bottom: 8px } .mb-2 { margin-bottom: 16px } .mb-3 { margin-bottom: 24px }
.hide-sm { display: none; }

/* --- 14. Grand écran ----------------------------------------------------- */
@media (min-width: 1024px) {
  .app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; height: 100vh; }
  .hide-sm { display: revert; }
  .only-sm { display: none !important; }
}

/* --- 15. Petit écran ----------------------------------------------------- */
@media (max-width: 1023px) {
  .page { padding: 18px 16px 96px; }

  /* Tiroir piloté par la case masquée : ouvrable au doigt, sans JavaScript. */
  .topbar {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 30;
  }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 50;
    width: 268px; max-width: 82vw;
    transform: translateX(-100%);
    transition: transform .18s ease;
    overflow-y: auto;
  }
  #drawer:checked ~ .app .sidebar { transform: none; }
  .scrim {
    position: fixed; inset: 0; z-index: 45;
    background: rgba(25, 27, 25, .3);
    opacity: 0; pointer-events: none; transition: opacity .18s ease;
  }
  #drawer:checked ~ .app .scrim { opacity: 1; pointer-events: auto; }
  #drawer:focus-visible ~ .app .burger { outline: 2px solid var(--accent); outline-offset: 2px; }

  .kpi-row { grid-template-columns: 1fr; }
  .kpi { border-left: 0; border-top: 1px solid var(--line); padding: 14px 16px; }
  .kpi:first-child { border-top: 0; }
  .kpi-value { font-size: 30px; }
  .grid--2, .grid--3, .grid--main, .grid--wide { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .page-title { font-size: 24px; }
}

@media (max-width: 640px) {
  /* Sous 16px, iOS zoome à chaque mise au point d'un champ. */
  input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px; }

  /* Les tableaux deviennent des fiches ; chaque cellule porte son intitulé. */
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table thead { display: none; }
  .table tr {
    border: 1px solid var(--line); border-radius: var(--r-card);
    padding: 6px 2px; margin-bottom: 10px; background: var(--surface);
  }
  .table tbody tr:hover { background: var(--surface); }
  .table td { border: 0 !important; padding: 5px 14px; display: flex; gap: 12px; align-items: baseline; }
  .table td::before {
    content: attr(data-label);
    flex: 0 0 6rem;
    font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em;
    color: var(--ink-3); font-weight: 500;
  }
  .table td[data-label=""]::before { display: none; }
  .table td > * { min-width: 0; }
  .num { text-align: left; }
}

/* --- 16. Pages publiques -------------------------------------------------- */
/* Connexion et formulaire de stand : une colonne, des cibles généreuses. */
.public-shell {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px;
  padding: 28px 16px calc(28px + env(safe-area-inset-bottom));
}
.public-card {
  width: 100%; max-width: 430px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 26px 24px;
}
.public-brand {
  font-family: var(--serif);
  font-size: 26px;
  text-align: center;
  letter-spacing: -.015em;
}
.public-title { font-family: var(--serif); font-size: 24px; text-align: center; }
.public-lede { text-align: center; color: var(--ink-2); }

/* Sur un stand, on remplit debout : les champs doivent être grands. */
.public .field > label { font-size: 12px; text-transform: none; letter-spacing: 0; color: var(--ink-2); }
.public input:not([type=checkbox]), .public select, .public textarea {
  font-size: 16px;
  padding: 11px 13px;
}
.public .btn { padding: 13px 18px; font-size: 15px; }

/* --- 17. Blocs de tâche (modèles de checklist) ----------------------------- */
.task-row { background: var(--sunken); }
.task-row .field > label { color: var(--ink-3); }

/* --- 17c. Lien d'invitation ------------------------------------------------ */
/* Le lien se lit et se copie, il ne se saisit pas : le champ reste un champ
   pour que la sélection au clavier marche, mais s'efface visuellement. */
.invitation-link {
  flex: 1; min-width: 0; background: var(--sunken); border: 1px solid var(--line);
  border-radius: var(--r-control); color: var(--ink-2);
  font-size: 12px; padding: 6px 9px; text-overflow: ellipsis;
}
.invitation--fresh { background: var(--ok-bg); }

/* --- 17b. Calendrier ------------------------------------------------------- */
/* FullCalendar injecte ses styles : on l'accorde au reste plutôt que de le
   laisser détonner. */
/* Le filet par défaut est trop clair pour une grille : à cette densité, la
   structure du mois disparaît. Le calendrier prend le filet appuyé. */
.fc { --fc-border-color: var(--line-2); --fc-today-bg-color: var(--accent-bg); font-size: 13px; }
.fc .fc-toolbar-title { font-family: var(--serif); font-size: 20px; font-weight: 400; }
.fc .fc-button {
  background: var(--surface); border: 1px solid var(--line-2); color: var(--ink);
  font-size: 12.5px; font-weight: 400; padding: 5px 11px; border-radius: var(--r-control);
  text-transform: none; box-shadow: none;
}
.fc .fc-button:hover { background: var(--sunken); }
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.fc .fc-button-primary:disabled { background: var(--sunken); border-color: var(--line); color: var(--ink-3); }
.fc .fc-col-header-cell-cushion { color: var(--ink-3); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding: 7px 4px; }
.fc .fc-daygrid-day-number { color: var(--ink-2); font-size: 12px; }
.fc .fc-event { border-radius: 3px; border: 0; }
.fc .fc-list-day-cushion { background: var(--sunken); }

/* --- 18. Impression ------------------------------------------------------ */
@media print {
  .sidebar, .topbar, .scrim, .no-print { display: none !important; }
  .app { display: block; }
  .page { padding: 0; }
}
