/* ============================================================
   Camosuite : le design system partagé.
   Une seule feuille pour toutes les pages ; chaque page n'ajoute que
   ce qui lui est propre dans un <style> en tête.
   ============================================================ */

/* Un `display` de classe l'emporterait sinon sur l'attribut `hidden`. */
[hidden] { display: none !important; }

:root {
  --ink: #1f1b2e;
  --ink-soft: #5f5a72;
  --paper: #f6f4fb;
  --card: #ffffff;
  --line: #e4e0ef;
  --accent: #6d4fd2;
  --accent-dark: #5238ad;
  --accent-soft: #eee9fb;
  --ok: #2f6b4f;
  --ok-soft: #e8f2ea;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(31, 27, 46, 0.08), 0 8px 24px rgba(31, 27, 46, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

/* Les pages restent masquées tant que la session n'est pas confirmée,
   pour ne pas montrer un outil à quelqu'un qui va être renvoyé au login. */
html:not(.camo-authed) body { visibility: hidden; }

/* ---------- Accueil (hub) ---------- */

.hub {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}

.hub-header { text-align: center; margin-bottom: 40px; }
.hub-logo { font-size: 52px; line-height: 1; margin-bottom: 12px; }
.hub-header h1 { font-size: 40px; letter-spacing: -0.02em; margin: 0 0 8px; }
.hub-header h1 .camo { color: var(--accent); }
.hub-tagline { color: var(--ink-soft); font-size: 17px; margin: 0; }

.hub-session {
  position: absolute; top: 16px; right: 16px;
  display: flex; gap: 8px; align-items: center;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.tool-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
a.tool-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 2px 6px rgba(31, 27, 46, 0.1), 0 14px 32px rgba(31, 27, 46, 0.1);
}
.tool-card .tool-icon { font-size: 34px; line-height: 1; }
.tool-card h2 { margin: 4px 0 0; font-size: 19px; letter-spacing: -0.01em; }
.tool-card p { margin: 0; font-size: 14px; color: var(--ink-soft); line-height: 1.5; }
.tool-card .tool-ou {
  margin-top: auto; padding-top: 10px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--accent);
}

/* Un outil que ce compte ne peut pas ouvrir reste visible, mais éteint. */
.tool-card.fermee { opacity: 0.72; box-shadow: none; background: var(--paper); border-style: dashed; }
.tool-card.fermee .tool-ou { color: var(--ink-soft); }
.tool-card .tool-etiquette {
  position: absolute; top: 14px; right: 14px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--accent-soft); color: var(--accent-dark);
  border-radius: 999px; padding: 3px 9px;
}
.tool-card.fermee .tool-etiquette { background: var(--line); color: var(--ink-soft); }

.hub-pied {
  display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center;
  margin-top: 40px; font-size: 13.5px; color: var(--ink-soft);
}
.hub-pied a { color: var(--ink-soft); text-decoration: none; font-weight: 600; }
.hub-pied a:hover { color: var(--accent); }

.empty-msg { color: var(--ink-soft); font-size: 14px; text-align: center; padding: 24px; }

/* ---------- Barre du haut (commune aux pages) ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.topbar-back { text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap; }
.topbar h1 { font-size: 17px; margin: 0; flex-grow: 1; letter-spacing: -0.01em; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.topbar-actions .btn,
.topbar-actions .btn-icon,
.topbar-actions .user-chip {
  height: 34px; display: inline-flex; align-items: center; gap: 5px;
  box-sizing: border-box; padding-top: 0; padding-bottom: 0; font-size: 13px;
}

a.btn { text-decoration: none; color: var(--ink); }

/* ---------- Boutons ---------- */

.btn {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  transition: background 0.1s ease, border-color 0.1s ease;
}
.btn:hover { background: var(--paper); border-color: var(--ink-soft); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
a.btn-primary { color: #fff; }
.btn-danger { background: #b83a2c; border-color: #b83a2c; color: #fff; }
.btn-danger:hover { background: #952b20; border-color: #952b20; }
.btn-grand { font-size: 16px; padding: 12px 22px; border-radius: 10px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.btn-icon {
  border: none; background: transparent; cursor: pointer;
  font-size: 13px; color: var(--ink-soft); padding: 4px; border-radius: 6px; line-height: 1;
}
.btn-icon:hover { background: var(--line); color: var(--ink); }
.btn-icon.del:hover { background: #fbeae6; color: #b83a2c; }

/* ---------- Cartes de formulaire ---------- */

.form-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 22px;
}
.form-card > h2:first-child, .form-card > h3:first-child { margin-top: 0; }
.form-card h2 {
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--accent); margin: 0 0 12px;
}
.form-card label {
  display: block; font-size: 12px; font-weight: 600; color: var(--ink-soft); margin-bottom: 10px;
}
.form-card .opt { font-weight: 400; opacity: 0.7; }
.form-card input[type="text"],
.form-card input[type="password"],
.form-card input[type="email"],
.form-card input[type="url"],
.form-card input[type="number"],
.form-card textarea,
.form-card select {
  display: block; width: 100%; margin-top: 4px;
  font-family: var(--font); font-size: 14px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
}
.form-card input:focus, .form-card textarea:focus, .form-card select:focus {
  outline: 2px solid var(--accent); outline-offset: -1px;
}
.form-card textarea { resize: vertical; }
.form-card form > label { display: block; margin-bottom: 16px; }
.form-card p:last-child { margin-bottom: 0; }

.hint { font-size: 12.5px; color: var(--ink-soft); margin: -6px 0 10px; line-height: 1.5; }
.form-card > .hint:first-of-type { margin-top: 0; }

/* Une case à cocher avec son libellé sur la même ligne, à l'inverse
   des champs de saisie qui prennent toute la largeur. */
.coche {
  display: flex; align-items: center; gap: 9px;
  font-size: 14px; font-weight: 500; color: var(--ink);
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper);
  cursor: pointer; margin-bottom: 8px;
}
.coche input { margin: 0; accent-color: var(--accent); width: auto; }
.coche:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.coche input:disabled + span { opacity: 0.6; }
.coches { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.coches .coche { margin-bottom: 0; }

/* ---------- Divers ---------- */

.user-chip {
  font-size: 12px; font-weight: 600; color: var(--ink-soft);
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 10px; white-space: nowrap;
}
.chip {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  border-radius: 999px; padding: 2px 9px; white-space: nowrap;
}
.chip-super { color: var(--accent-dark); background: var(--accent-soft); }
.chip-membre { color: var(--ink-soft); background: var(--line); }
.chip-moi { color: var(--ok); background: var(--ok-soft); }

.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px;
}
.lien-boite {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.lien-boite code {
  flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
}

/* Une rangée de liste : un compte, une invitation, un événement. */
.rangee {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; background: var(--paper);
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px;
}
.rangee .nom { font-weight: 700; }
.rangee .quand { font-size: 12px; color: var(--ink-soft); }
.rangee .spacer { flex-grow: 1; }
.rangee .fleche { color: var(--ink-soft); font-size: 18px; line-height: 1; }
a.rangee { text-decoration: none; color: inherit; cursor: pointer; }
a.rangee:hover { border-color: var(--accent); }
.rangee .outils { font-size: 14px; letter-spacing: 2px; }

/* ---------- Les messages : « ✓ enregistré », « ⚠️ il manque… » ---------- */

.ok, .err {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 0 0 14px; padding: 12px 16px;
  border: 1px solid var(--line); border-left: 4px solid var(--line);
  border-radius: 10px; background: var(--card);
  box-shadow: 0 1px 2px rgba(31, 27, 46, 0.05);
  font-size: 14px; line-height: 1.5; color: var(--ink);
  animation: camo-message 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.ok { border-color: #cfe0d2; border-left-color: var(--ok); background: #f4f9f4; }
.err { border-color: #e9cec6; border-left-color: #b83a2c; background: #fbeae6; }
.ok:empty, .err:empty { display: none; }
@keyframes camo-message { from { transform: translateY(-6px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ok, .err { animation: none; } }

/* Un encart d'explication, plus calme qu'un message. */
.note {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; font-size: 13.5px; line-height: 1.55;
  margin-bottom: 14px;
}
.note .e { font-size: 18px; line-height: 1.2; flex-shrink: 0; }
.note p { margin: 0; }
.note p + p { margin-top: 6px; }

/* ---------- Suite fermée pour travaux ---------- */

.camo-travaux {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; background: var(--paper);
}
.camo-travaux .boite {
  max-width: 420px; text-align: center;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 34px 30px; box-shadow: var(--shadow);
}
.camo-travaux .engin { font-size: 52px; line-height: 1; margin-bottom: 12px; }
.camo-travaux h1 { margin: 0 0 10px; font-size: 22px; }
.camo-travaux p { margin: 0 0 20px; color: var(--ink-soft); font-size: 14.5px; line-height: 1.55; }

/* Bandeau côté administration quand la suite est fermée. */
.camo-ferme {
  position: fixed; left: 0; right: 0; top: 0; z-index: 350; height: 30px;
  display: flex; align-items: center; justify-content: center; padding: 0 14px;
  background: #d9a13c; color: #2b2723; font-size: 12.5px; font-weight: 700; text-align: center;
}
body.camo-avec-bandeau { padding-top: 30px; }
body.camo-avec-bandeau .hub-session { top: 46px; }

/* ---------- « Ça charge » ----------
   Le cadre n'apparaît qu'au bout de sept dixièmes de seconde : en deçà,
   il serait vu comme un clignotement. */
.camo-charge {
  position: fixed; left: 50%; bottom: 26px;
  z-index: 60; display: flex; align-items: center; gap: 11px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 10px 20px;
  font-size: 13.5px; font-weight: 650; color: var(--ink-soft);
  box-shadow: var(--shadow);
  opacity: 0; transform: translateX(-50%) translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.camo-charge.vu { opacity: 1; transform: translateX(-50%); }
.camo-charge .roue-charge {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: camo-tourne 0.7s linear infinite;
}
@keyframes camo-tourne { to { transform: rotate(360deg); } }

/* ---------- Administration : menu de gauche et réglages ---------- */

.admin-layout { display: grid; grid-template-columns: 232px 1fr; gap: 20px; align-items: start; }
@media (max-width: 780px) { .admin-layout { grid-template-columns: 1fr; } }

.admin-menu {
  position: sticky; top: 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px; display: flex; flex-direction: column; gap: 2px;
}
.admin-menu .groupe {
  margin: 10px 10px 4px; font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft);
}
.admin-menu .groupe:first-child { margin-top: 4px; }
.admin-menu .entree {
  display: block; width: 100%; text-align: left;
  font-family: var(--font); font-size: 14px; font-weight: 600; color: var(--ink);
  background: transparent; border: 0; border-radius: 8px; padding: 8px 10px;
  cursor: pointer; text-decoration: none;
}
.admin-menu .entree:hover { background: var(--paper); }
.admin-menu .entree.active { background: var(--accent-soft); color: var(--accent-dark); }

.reglage {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.reglage:last-child { border-bottom: 0; padding-bottom: 0; }
.reglage .quoi { flex: 1 1 260px; min-width: 0; }
.reglage .quoi b { display: block; font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.reglage .quoi span { display: block; font-size: 12.5px; color: var(--ink-soft); line-height: 1.55; }

/* ---------- Fiche d'un compte ---------- */

.fiche-tete { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.fiche-tete .avatar {
  width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800;
}
.fiche-tete h2 {
  margin: 0; font-size: 22px; text-transform: none; letter-spacing: -0.01em; color: var(--ink);
}
.fiche-tete .sous { font-size: 12.5px; color: var(--ink-soft); }
.infos { list-style: none; margin: 0; padding: 0; }
.infos li {
  display: flex; gap: 12px; align-items: baseline;
  padding: 8px 0; border-top: 1px solid var(--line); font-size: 13.5px;
}
.infos li .quoi { flex: 0 0 180px; color: var(--ink-soft); }
@media (max-width: 560px) {
  .infos li { flex-direction: column; gap: 0; }
  .infos li .quoi { flex: none; font-size: 12px; }
}

/* ---------- Le journal des nouveautés ---------- */

.entry {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 18px 20px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.entry .date {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--accent); margin: 0 0 4px;
}
.entry h2 { margin: 0 0 10px; font-size: 19px; letter-spacing: -0.01em; }
.entry ul { margin: 0; padding-left: 20px; }
.entry li { font-size: 14px; line-height: 1.6; margin-bottom: 6px; }

/* ---------- Mise en page des pages intérieures ---------- */

body.page { min-height: 100vh; display: flex; flex-direction: column; }
.wrap { max-width: 640px; width: 100%; margin: 0 auto; padding: 16px 16px 48px; flex-grow: 1; }
.wrap.large { max-width: 1080px; }
