/* Police hébergée localement (copiée au build depuis @fontsource/source-sans-3) */
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 300; font-display: swap;
  src: url("/static/vendor/fonts/source-sans-3-latin-300-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/static/vendor/fonts/source-sans-3-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/static/vendor/fonts/source-sans-3-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/static/vendor/fonts/source-sans-3-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 900; font-display: swap;
  src: url("/static/vendor/fonts/source-sans-3-latin-900-normal.woff2") format("woff2"); }

/* CRM — feuille unique, mobile d'abord.
   Palette dérivée du vert gouvaert.fr, fond papier chaud, encre sombre. */
/* Charte GOUVAERT (gouvaert.fr) : papier #fafafa, encre noire, texte #585858,
   accent turquoise #1CBD9C, tuiles turquoise/bleu/violet, Source Sans 3. */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f1f1f1;
  --ink: #111111;
  --ink-2: #585858;
  --ink-3: #6b6b6b;
  --line: #e6e6e6;
  --teal: #1cbd9c;          /* accent de marque : remplissages, traits, points */
  --brand: #0e7c66;         /* turquoise foncé : texte et liens (contraste AA) */
  --brand-2: #1cbd9c;
  --brand-soft: #e3f6f1;
  --on-teal: #000000;       /* texte sur turquoise : noir, comme le logo */
  --tile-blue: #7ecaf6;
  --tile-violet: #8499e7;
  --warn: #b8304f;          /* rose de l'ancien site, assombri pour le texte */
  --warn-soft: #fde9ee;
  --wa: #1cbd9c; --sms: #4aa8dd; --msg: #8499e7; --mail: #9a9a9a;
  --radius: 6px;
  --tap: 44px;
  --font: "Source Sans 3", "Source Sans Pro", Helvetica, Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111312; --surface: #1a1c1b; --surface-2: #232625; --ink: #f2f2f2;
    --ink-2: #b4b4b4; --ink-3: #969696; --line: #2e3130; --brand: #5fd9bd;
    --brand-soft: #16332c; --warn: #f2849e; --warn-soft: #3a1f26;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.45 var(--font);
  padding-bottom: calc(72px + var(--safe-b));
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px; }

/* ---- barre du haut --------------------------------------------------- */
.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top .wrap { display: flex; align-items: center; gap: 8px; min-height: 56px; }
.top h1 { font-size: 24px; font-weight: 700; flex: 1; letter-spacing: -.035em; }
.top .sub { color: var(--ink-2); font-size: 13px; font-weight: 500; display: block; }
.icon-btn {
  width: var(--tap); height: var(--tap); display: grid; place-items: center;
  border-radius: 12px; color: var(--ink-2); background: none; border: 0;
}
.icon-btn:active { background: var(--surface-2); }
.back { margin-left: -10px; }

/* ---- barre d'onglets ------------------------------------------------- */
.tabs {
  position: fixed; inset: auto 0 0 0; z-index: 20;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.tabs ul { display: grid; grid-template-columns: repeat(4, 1fr); max-width: 640px;
  margin: 0 auto; padding: 0; list-style: none; }
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 6px; font-size: 11px; font-weight: 600; color: var(--ink-3); position: relative; }
.tabs a[aria-current="page"] { color: var(--ink); }
.tabs a[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; background: var(--teal); }
.tabs .badge { position: absolute; top: 4px; left: calc(50% + 6px); }

/* ---- sections & cartes ---------------------------------------------- */
.section { margin: 20px 0 8px; display: flex; align-items: baseline; justify-content: space-between; }
.section h2 { font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .22em; color: var(--ink-2); }
.section a { font-size: 14px; color: var(--brand); font-weight: 600; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.list { list-style: none; margin: 0; padding: 0; }
.list > li + li { border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 56px; }
.row:active { background: var(--surface-2); }
.row .main { flex: 1; min-width: 0; }
.row .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .meta { color: var(--ink-2); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .aside { color: var(--ink-3); font-size: 13px; text-align: right; white-space: nowrap; }
.empty { padding: 18px 14px; color: var(--ink-3); font-size: 15px; }

.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 2px var(--teal);
}
.avatar.lg { width: 72px; height: 72px; font-size: 26px; }
/* Teinte stable par personne (filtre |tone), palette des tuiles gouvaert.fr */
.avatar.tone-0 { background: #c9eee6; color: #0b5c4c; box-shadow: none; }
.avatar.tone-1 { background: #d3ecfb; color: #1b5f86; box-shadow: none; }
.avatar.tone-2 { background: #dde3f8; color: #3b4a9a; box-shadow: none; }
.avatar.tone-3 { background: #fbdbe3; color: #9b2743; box-shadow: none; }

/* Indicateurs actionnables (Aujourd'hui) */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 14px 0 4px; }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { display: block; border-radius: 12px; padding: 12px 14px; }
.kpi b { display: block; font-size: 26px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.kpi span { font-size: 13px; color: #444; }
.kpi.tone-0 { background: #e9f8f4; } .kpi.tone-0 b { color: #0e7c66; }
.kpi.tone-1 { background: #e8f4fc; } .kpi.tone-1 b { color: #1f6f9e; }
.kpi.tone-2 { background: #eceffb; } .kpi.tone-2 b { color: #3b4a9a; }
.kpi.tone-warn { background: #fdecf0; } .kpi.tone-warn b { color: #b8304f; }
@media (prefers-color-scheme: dark) { .kpi { background: var(--surface) !important; } .kpi span { color: var(--ink-2); } }

.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--warn); color: #fff; font-size: 11px; font-weight: 700; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px;
  font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.ok { background: var(--brand-soft); color: var(--brand); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.ch-whatsapp { --c: var(--wa); } .ch-sms { --c: var(--sms); } .ch-messenger { --c: var(--msg); }
.ch-email, .ch-matrix, .ch-call { --c: var(--mail); }
.ch { color: var(--c); } .ch .dot, .dot.ch { background: var(--c); }

/* ---- événements ------------------------------------------------------ */
.event { display: grid; grid-template-columns: 52px 1fr; gap: 12px; padding: 12px 14px; }
.event .time { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px; }
.event .time small { display: block; color: var(--ink-3); font-weight: 500; font-size: 12px; }
.event .bar { border-left: 3px solid var(--cal, var(--teal)); padding-left: 10px; min-width: 0; }
.event .title { font-weight: 600; }
.event .meta { color: var(--ink-2); font-size: 14px; }
.people { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px;
  border-radius: 99px; background: var(--surface-2); font-size: 13px; font-weight: 600; }
.chip .avatar { width: 22px; height: 22px; font-size: 10px; }
.chip.present { background: var(--brand-soft); color: var(--brand); }
.chip.absent { text-decoration: line-through; color: var(--ink-3); }
.chip.add { padding: 4px 12px; border: 1px dashed var(--ink-3); background: none; color: var(--ink-2); }
.past { opacity: .72; }

/* ---- semaine (agenda) ------------------------------------------------ */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 10px 0; }
.week a { display: flex; flex-direction: column; align-items: center; padding: 6px 0 8px;
  border-radius: 12px; font-size: 12px; color: var(--ink-2); }
.week b { font-size: 17px; color: var(--ink); }
.week .n { width: 5px; height: 5px; border-radius: 50%; background: var(--brand-2); margin-top: 3px; }
.week .n.zero { background: transparent; }
.week a.today b { color: var(--brand); }
.week a[aria-current="date"] { background: var(--teal); color: var(--on-teal); }
.week a[aria-current="date"] b { color: var(--on-teal); }
.week a[aria-current="date"] .n { background: var(--on-teal); }

/* ---- fiche contact --------------------------------------------------- */
.hero { text-align: center; padding: 20px 0 8px; }
.hero h1 { font-size: 24px; margin-top: 10px; }
.hero .meta { color: var(--ink-2); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 15px; }
.stat span { font-size: 12px; color: var(--ink-3); }
.stat.warn b { color: var(--warn); }
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 16px 16px; }
.timeline li::before { content: ""; position: absolute; left: -21px; top: 6px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--c, var(--ink-3)); }
.timeline .when { font-size: 12px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.timeline .what { font-size: 15px; }
.timeline .note { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-top: 4px; white-space: pre-wrap; }

/* ---- formulaires ----------------------------------------------------- */
.field { display: block; margin: 0 0 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
input[type=text], input[type=search], input[type=email], input[type=tel], input[type=date],
input[type=password], select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px; font: inherit; font-size: 16px;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 4px;
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-2); outline-offset: 1px; border-color: transparent; }
.search { position: relative; margin: 12px 0; }
.search input { padding-left: 40px; border-radius: 99px; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 0 16px; border-radius: 4px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; }
.btn.primary { background: var(--teal); border-color: var(--teal); color: var(--on-teal); font-weight: 700; }
.btn.ghost { background: none; border-color: transparent; color: var(--brand); }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn:active { transform: scale(.98); }
.seg { display: grid; grid-auto-flow: column; gap: 6px; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline > input { flex: 1; }
form.inline-form { display: inline; margin: 0; }
.chips-filter { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips-filter a { padding: 7px 14px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line);
  font-size: 14px; font-weight: 600; white-space: nowrap; color: var(--ink-2); }
.chips-filter a[aria-current="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.label { font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .22em; }
details.sheet > summary { list-style: none; cursor: pointer; }
details.sheet > summary::-webkit-details-marker { display: none; }
details.sheet[open] > summary { margin-bottom: 10px; }
.notice { padding: 12px 14px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); font-weight: 600; margin: 12px 0; }
.error { background: var(--warn-soft); color: var(--warn); }

.fab { position: fixed; right: 16px; bottom: calc(84px + var(--safe-b)); z-index: 15;
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  background: var(--teal); color: var(--on-teal); box-shadow: 0 6px 18px rgba(0,0,0,.14); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login .card { width: 100%; max-width: 380px; padding: 28px 22px; }
.login .logo { display: block; margin-bottom: 18px; }
.wordmark { font-weight: 300; letter-spacing: .45em; font-size: 15px; color: var(--ink); }
.wordmark b { font-weight: 300; color: var(--teal); }

@media (min-width: 900px) {
  body { padding-bottom: 0; padding-left: 88px; }
  .tabs { inset: 0 auto 0 0; width: 88px; border-top: 0; border-right: 1px solid var(--line); padding-top: 16px; }
  .tabs ul { grid-template-columns: 1fr; gap: 6px; }
  .fab { bottom: 24px; }
}

/* ---- Admin et Sécurité ------------------------------------------------ */
.subnav { display: inline-grid; grid-auto-flow: column; background: var(--surface-2); border-radius: 999px; padding: 3px; margin: 12px 0 4px; }
.subnav a { padding: 8px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.subnav a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.form-card { padding: 14px; }
.form-card .field:last-child { margin-bottom: 0; }
.field .hint { display: block; font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.field .err { display: block; font-size: 13px; color: var(--warn); font-weight: 600; margin-top: 4px; }
.field.invalid input { border-color: var(--warn); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--tap); margin: 0 0 10px; font-weight: 600; }
.switch input { width: 46px; height: 26px; appearance: none; -webkit-appearance: none; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--teal); }
.switch input:checked::after { left: 23px; }
.overridden { font-size: 11px; font-weight: 700; color: var(--brand); margin-left: 6px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; padding: 12px 14px; font-size: 15px; }
.kv dt { color: var(--ink-2); } .kv dd { margin: 0; font-weight: 600; text-align: right; }
.tbl { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.log { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.log th { text-align: left; font-size: 11px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.log td { padding: 9px 12px; border-top: 1px solid var(--line); white-space: nowrap; vertical-align: top; }
table.log tr:first-child td { border-top: 0; }
table.log td.path { max-width: 260px; overflow: hidden; text-overflow: ellipsis; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
table.log a { color: var(--brand); }
.st-2 { color: var(--brand); } .st-3 { color: var(--ink-2); } .st-4, .st-5 { color: var(--warn); font-weight: 700; }
@media (min-width: 900px) { .wrap.wide { max-width: 1100px; } }
input[type=url], input[type=time], input[type=number] {
  width: 100%; min-height: var(--tap); padding: 10px 12px; font: inherit; font-size: 16px;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 4px; }
