/* Fill’in — app du secrétariat. Mise en page : barre latérale sur ordinateur, barre d'onglets en bas sur téléphone. */
:root {
  --bg: #F6F4EF; --surface: #FFFFFF; --fg: #14201C; --muted: #6B6A62; --line: #E4DED2; --soft: #ECE8DF;
  --accent: #0F3B33; --accent-fg: #FFFFFF; --mark: #C9A45C; --mark-fg: #14201C;
  --ok: #1E8A5A; --warn: #B86F00; --bad: #C2412D;
  --f-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --f-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --nav-w: 220px; --tab-h: 62px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1614; --surface: #15201D; --fg: #E6EEEB; --muted: #93A6A0; --line: #26332F; --soft: #1B2925;
    --accent: #4FC3A1; --accent-fg: #06221B; --ok: #4CC28A; --warn: #E6A93A; --bad: #EF7A66;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--f-body); -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--f-display); margin: 0; line-height: 1.15; text-wrap: balance; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.1rem; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.brand { display: flex; align-items: center; gap: 10px; font: 800 1.25rem/1 var(--f-display); }
.brand.big { font-size: 1.8rem; }
.mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent);
  color: var(--accent-fg); font-size: 1rem; box-shadow: inset 0 -5px 0 var(--mark); }
.brand.big .mark { width: 44px; height: 44px; font-size: 1.4rem; }

/* connexion */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left)); }
.login-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; display: grid; gap: 16px; }
.login-card form { display: grid; gap: 10px; }
.error { color: var(--bad); font-size: .9rem; min-height: 1.2em; }

/* coque */
.shell { display: grid; grid-template-columns: var(--nav-w) 1fr; min-height: 100vh; }
.nav { position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px; padding: 20px 12px; }
.nav .brand { padding: 4px 10px 18px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--fg); text-decoration: none; font-weight: 500; position: relative; }
.nav a svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav a:hover { background: var(--soft); }
.nav a[aria-current="page"] { background: var(--soft); color: var(--accent); }
.badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--bad); color: #fff; font-size: .72rem; display: grid; place-items: center; }
.nav-foot { margin-top: auto; padding: 10px; display: grid; gap: 2px; font-size: .85rem; }
.view { padding: 28px max(16px, env(safe-area-inset-right)) 40px 32px; max-width: 1100px; width: 100%; outline: none; min-width: 0; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .nav { position: fixed; inset: auto 0 0 0; top: auto; height: auto; flex-direction: row; justify-content: space-around; gap: 0;
    padding: 6px max(4px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
    border-right: 0; border-top: 1px solid var(--line); z-index: 20; }
  .nav .brand, .nav-foot { display: none; }
  .nav a { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: .68rem; flex: 1; text-align: center; }
  .nav a[aria-current="page"] { background: transparent; }
  .badge { position: absolute; top: 2px; left: calc(50% + 6px); margin: 0; }
  .view { padding: calc(18px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) calc(var(--tab-h) + 28px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
}

/* en-têtes de vue */
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.head .sub { color: var(--muted); margin-top: 4px; }
.section { margin-top: 28px; display: grid; gap: 10px; }
.section > .row-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* boutons */
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 14px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.warn { color: var(--bad); }
.btn.sm { padding: 6px 10px; min-height: 34px; font-size: .85rem; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* indicateurs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.kpi b { display: block; font: 800 1.6rem/1.1 var(--f-display); font-variant-numeric: tabular-nums; }
.kpi span { color: var(--muted); font-size: .82rem; }
.kpi.hero { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.kpi.hero span { color: inherit; opacity: .85; }
.kpi.hero b { color: var(--mark); }

/* listes de rendez-vous */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.item { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .time { font-weight: 600; font-variant-numeric: tabular-nums; }
.item .who { min-width: 0; }
.item .who b { font-weight: 600; }
.item .meta { font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }
.item.now { box-shadow: inset 4px 0 0 var(--accent); }
.item.gone { opacity: .55; }
.item.filled { box-shadow: inset 4px 0 0 var(--mark); }
@media (max-width: 560px) {
  .item { grid-template-columns: 52px minmax(0, 1fr); }
  .item .actions { grid-column: 1 / -1; justify-content: flex-start; }
}
.pill { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .74rem; font-weight: 600; white-space: nowrap; vertical-align: 1px; }
.r-faible { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.r-moyen { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.r-élevé { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.st-ok { color: var(--ok); } .st-bad { color: var(--bad); } .st-warn { color: var(--warn); }
.lang { background: var(--soft); color: var(--fg); }
.day-title { font: 600 .8rem/1 var(--f-body); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }
.empty { padding: 22px; color: var(--muted); text-align: center; }

/* messages */
.todo { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--mark) 18%, var(--surface)); }
.todo:last-child { border-bottom: 0; }
.todo time, .bubble time { font-size: .75rem; color: var(--muted); }
.convs { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.conv { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.bubble { max-width: 92%; padding: 8px 10px; border-radius: 12px; font-size: .88rem; overflow-wrap: anywhere; }
.bubble.out { background: var(--soft); justify-self: end; border-bottom-right-radius: 4px; }
.bubble.in { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border-bottom-left-radius: 4px; }
.feed .ev { font-size: .85rem; padding: 8px 0 8px 10px; border-left: 3px solid var(--line); margin-bottom: 6px; }
.feed .ev.ok { border-color: var(--ok); } .feed .ev.bad { border-color: var(--bad); } .feed .ev.warn { border-color: var(--warn); }

/* formulaires */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: grid; gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; align-items: start; }
label.field { display: grid; gap: 5px; font-size: .88rem; font-weight: 500; }
input, select, textarea { width: 100%; padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); min-height: 42px; }
textarea { resize: vertical; }
.check { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; font-size: .9rem; }
.check input[type=checkbox] { width: 20px; height: 20px; min-height: 0; margin: 2px 0 0; accent-color: var(--accent); }
.inline-num { width: 64px; min-height: 0; padding: 3px 6px; display: inline-block; }
.hint { font-size: .8rem; color: var(--muted); }

/* panneau (formulaires d'ajout) */
.sheet { border: 0; border-radius: 16px; padding: 0; width: min(520px, calc(100% - 24px)); background: var(--surface); color: var(--fg); }
.sheet::backdrop { background: rgb(0 0 0 / .4); }
.sheet form { display: grid; gap: 12px; padding: 20px; }
.sheet .actions { margin-top: 6px; }
@media (max-width: 560px) {
  .sheet { margin: auto auto 0; width: 100%; max-width: 100%; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); }
}
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + 20px + env(safe-area-inset-bottom)); background: var(--fg); color: var(--bg);
  padding: 10px 16px; border-radius: 10px; font-size: .9rem; z-index: 50; max-width: calc(100% - 32px); }
@media (min-width: 861px) { .toast { bottom: 24px; } }
@media (prefers-reduced-motion: no-preference) { .item, .todo { transition: background .3s; } }
.mark { display: inline-grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 7px; box-shadow: none; }
.brand.big .mark { gap: 4px; padding: 10px; }
.mark i { background: #2C5A4F; border-radius: 2px; }
.mark i.g { background: var(--mark); }
.mark i { display: block; width: 100%; height: 100%; }
.mark { place-items: stretch; }
