/* Charte « Calm Kit » : ivoire chaud, Sage, cartes arrondies à ombre douce, pilules, Inter. Densité d'outil métier. */
:root {
  --bg: #F4EFE8;          /* Ivory */
  --surface: #FBF9F5;     /* blanc cassé des cartes */
  --surface-2: #F4EFE8;
  --sage: #6B7F6E;        /* Sage : accents, points, barres, interrupteurs */
  --sage-ink: #5A6D5E;    /* Sage foncé : aplats portant du texte blanc et texte Sage sur ivoire (AA 4,8:1) */
  --sage-dark: #4C5D50;
  --moss: #A7B8A7;
  --mist: #D9E1D9;
  --mist-2: #EAEFEA;      /* Mist clair : survols, zones de saisie */
  --sand: #C9BDAF;
  --ink: #1E2A22;
  --ink-2: #5B655E;
  --ink-3: #626B65;
  --line: #D9E1D9;        /* filets Mist */
  --line-2: #C9BDAF;      /* bordures des champs (Sand) */
  --amber: #A05A00;
  --red: #B42318;
  --grey: #8A938D;
  --focus: #5A6D5E;
  --shadow: 0 8px 24px rgba(60, 50, 40, .08), inset 0 1px 0 rgba(255, 255, 255, .8);
  --r: 24px;
  --r-sm: 16px;
  --pill: 999px;
  --topbar: 56px;
  --sidebar: 256px;
  --tabbar: 0px;
  --sat: env(safe-area-inset-bottom, 0px);
  --control: 40px;
  --fast: 150ms;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0; min-height: 100%;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; touch-action: manipulation;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--sage-ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h1 { font-size: 20px; font-weight: 600; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0; }
small, .muted { color: var(--ink-2); font-size: 13px; }
strong { font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--sage-ink); color: #fff; padding: 8px 14px; border-radius: var(--pill); z-index: 100; }
.skip:focus { top: 8px; }
[hidden] { display: none !important; }
svg.ic { width: 18px; height: 18px; flex: none; }
.num { font-variant-numeric: tabular-nums; }

/* Titres de section : petites capitales espacées, numérotées */
main.content { counter-reset: sec; }
.card-head h2, .card-head h3, .kicker {
  font-size: 11.5px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-2); line-height: 1.4;
}
.card-head h2::before { counter-increment: sec; content: counter(sec, decimal-leading-zero) ".  "; white-space: pre; }

/* Boutons en pilule : primaire Sage plein, secondaire contour fin */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--control); padding: 6px 18px; border-radius: var(--pill); border: 1px solid var(--sage-ink);
  background: transparent; color: var(--sage-ink); font-weight: 500; text-decoration: none; white-space: nowrap;
  transition: background var(--fast), border-color var(--fast), color var(--fast);
}
.btn:hover { background: var(--mist-2); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--sage-ink); border-color: var(--sage-ink); color: #fff; }
.btn-primary:hover { background: var(--sage-dark); border-color: var(--sage-dark); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--mist-2); border-color: transparent; }
.btn-sm { min-height: 32px; padding: 3px 14px; font-size: 13px; }
.btn-icon { width: var(--control); padding: 0; }
.btn-round { background: var(--surface); border-color: var(--line); color: var(--ink); box-shadow: var(--shadow); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-ms { background: var(--surface); }

/* Connexion : carte unique */
.login { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; gap: 16px; }
.login-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: var(--r); padding: 32px; box-shadow: var(--shadow); }
.login-card .brand { margin-bottom: 24px; }
.login-card h1 { font-size: 18px; margin-bottom: 4px; }
.login-card .btn { width: 100%; min-height: 48px; }
.login-card .btn-ms { margin-top: 18px; }
.login-card .sep { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase; margin: 18px 0 14px; }
.login-card .sep::before, .login-card .sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.login-card .field + .btn { margin-top: 14px; }
.login-note { font-size: 12.5px; color: var(--ink-3); max-width: 420px; text-align: center; }

/* Marque */
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-mark { width: 32px; height: 32px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 14px; font-weight: 600; }
.brand-text small { font-size: 12px; color: var(--ink-2); }

/* Coque de l'application */
.app { display: none; min-height: 100dvh; }
body.connecte .app { display: block; }
body.connecte #ecran-connexion { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar);
  display: flex; align-items: center; gap: 10px; padding: 0 16px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.topbar .brand { flex: none; min-width: calc(var(--sidebar) - 16px); }
.topbar .brand-text small { white-space: nowrap; }
.topbar .spacer { flex: 1; }

/* Champ de recherche en pilule : loupe, saisie, filet, filtres */
.search-pill {
  display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 6px 0 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--pill); box-shadow: var(--shadow);
}
.search-pill > svg { width: 18px; height: 18px; flex: none; color: var(--ink-2); }
.search-pill input, .search-pill textarea { flex: 1; min-width: 0; border: 0; background: none; padding: 6px 0; font-size: 13.5px; resize: none; }
.search-pill input:focus, .search-pill textarea:focus { outline: none; }
.search-pill:focus-within { border-color: var(--sage-ink); }
.search-pill .sep { width: 1px; height: 22px; background: var(--line); flex: none; }
.search-pill .pill-ic { width: 36px; height: 36px; border: 0; background: none; border-radius: 50%; color: var(--ink-2); display: grid; place-items: center; flex: none; }
.search-pill .pill-ic:hover { background: var(--mist-2); color: var(--ink); }
.search-pill .pill-ic svg { width: 18px; height: 18px; }
.search-global { flex: 0 1 340px; }

/* Interrupteur en pilule Sage */
.toggle { display: inline-flex; align-items: center; gap: 8px; min-height: var(--control); padding: 0 8px; border: 0; background: none; border-radius: var(--pill); font-size: 13px; color: var(--ink-2); }
.toggle:hover { background: var(--mist-2); }
.toggle .track { width: 44px; height: 24px; border-radius: var(--pill); background: var(--sand); position: relative; transition: background var(--fast); flex: none; }
.toggle .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(60, 50, 40, .25); transition: transform var(--fast); }
.toggle[aria-checked="true"] .track { background: var(--sage); }
.toggle[aria-checked="true"] .track::after { transform: translateX(20px); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--mist); color: var(--sage-ink); display: grid; place-items: center; font-weight: 600; font-size: 11.5px; flex: none; position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; min-height: var(--control); border: 0; background: none; border-radius: var(--pill); padding: 0 10px 0 4px; text-align: left; }
.user-btn:hover { background: var(--mist-2); }
.user-btn .who { display: flex; flex-direction: column; line-height: 1.2; }
.user-btn .who strong { font-size: 13px; }
.user-btn .who small { font-size: 11.5px; }

/* Bandeau Mist du mode dégradé */
.bandeau {
  display: none; align-items: flex-start; gap: 10px; padding: 10px 16px; background: var(--mist); color: var(--ink);
  font-size: 13px; position: sticky; top: var(--topbar); z-index: 19;
}
.bandeau svg { width: 16px; height: 16px; flex: none; color: var(--sage-ink); margin-top: 2px; }
body.degrade .bandeau { display: flex; }

.layout { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: calc(100dvh - var(--topbar)); }
.sidebar { padding: 16px 12px; background: var(--bg); position: sticky; top: var(--topbar); height: calc(100dvh - var(--topbar)); overflow-y: auto; }
body.degrade .sidebar { top: calc(var(--topbar) + 60px); height: calc(100dvh - var(--topbar) - 60px); }
.nav { display: grid; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 14px; border-radius: var(--pill);
  color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 13.5px;
}
.nav a svg { color: var(--ink-3); }
.nav a:hover { background: var(--mist-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--sage-ink); color: #fff; }
.nav a[aria-current="page"] svg { color: #fff; }
.nav a .badge-count { margin-left: auto; }
.sidebar .sidebar-foot { margin-top: 20px; padding: 12px 14px 0; font-size: 12px; color: var(--ink-3); border-top: 1px solid var(--line); line-height: 1.45; }

main.content { padding: 20px 24px; min-width: 0; padding-bottom: calc(24px + var(--tabbar) + var(--sat)); }
main.content:focus { outline: none; }
.crumb { font-size: 12.5px; color: var(--ink-3); margin-bottom: 4px; }
.crumb a { color: var(--ink-3); text-decoration: none; }
.crumb a:hover { text-decoration: underline; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 16px; margin-bottom: 18px; }
.page-head > div:first-child { flex: 1 1 360px; min-width: 0; }
.page-head .sub { color: var(--ink-2); margin-top: 2px; max-width: 80ch; font-size: 13.5px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* Étiquettes et états */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; border: 1px solid var(--line); border-radius: var(--pill); padding: 0 9px; line-height: 22px; background: var(--surface); }
.badge svg { width: 13px; height: 13px; }
.badge-green, .badge-amber, .badge-red, .badge-grey, .badge-blue { border: 0; padding: 0; background: none; color: var(--ink); font-weight: 500; }
.badge-green::before, .badge-amber::before, .badge-red::before, .badge-grey::before, .badge-blue::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.badge-green::before { background: var(--sage); }
.badge-amber::before { background: var(--amber); }
.badge-red::before { background: var(--red); }
.badge-grey::before, .badge-blue::before { background: var(--grey); }
.badge-count { border: 0; background: var(--mist); color: var(--sage-ink); font-weight: 600; font-size: 11.5px; min-width: 22px; justify-content: center; padding: 0 7px; border-radius: var(--pill); line-height: 22px; }
.nav a[aria-current="page"] .badge-count { background: #fff; }

/* Cartes à grands arrondis, ombre douce */
.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)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.card, .right-card, .kpi, .filters, .table-wrap, .week { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); min-width: 0; }
.card, .right-card { padding: 18px 20px 20px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { flex: 1 1 160px; min-width: 0; }
.card-head .more { font-size: 13px; }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 18px 20px; }
.kpi .val { font-size: 26px; font-weight: 600; line-height: 1.2; }
.kpi .lab { color: var(--ink-2); font-size: 13px; }
.kpi .trend { font-size: 12.5px; color: var(--ink-3); }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; padding-top: 2px; }
.list .when { flex: none; width: 56px; font-size: 13px; color: var(--ink-2); padding-top: 1px; }
.list .what { flex: 1; min-width: 0; }
.list .what a { color: var(--ink); font-weight: 500; text-decoration: none; }
.list .what a:hover { text-decoration: underline; }
.list .what small { display: block; }
.list .ico { width: 18px; height: 18px; color: var(--ink-3); display: grid; place-items: center; flex: none; margin-top: 2px; }
.list .ico svg { width: 16px; height: 16px; }
.list .ico.red { color: var(--red); }
.list .ico.amber { color: var(--amber); }
.list .ico.blue { color: var(--ink-3); }

/* Cases à cocher arrondies, Sage */
.check { display: flex; gap: 10px; align-items: flex-start; min-height: 32px; }
.check input {
  appearance: none; -webkit-appearance: none; width: 20px; height: 20px; margin: 2px 0 0; flex: none; cursor: pointer;
  border: 1.5px solid var(--sand); border-radius: 6px; background: #fff; display: grid; place-items: center; transition: background var(--fast), border-color var(--fast);
}
.check input:checked { background: var(--mist-2); border-color: var(--sage); }
.check input:checked::before { content: ""; width: 10px; height: 5px; border: 2px solid var(--sage-ink); border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.check label { cursor: pointer; }
.check.done label { text-decoration: line-through; color: var(--ink-2); }

/* Barre de progression arrondie */
.progress { height: 12px; background: var(--mist); border-radius: var(--pill); overflow: hidden; }
.progress .fill { height: 100%; background: var(--sage); border-radius: var(--pill); }
.progress-row { display: flex; align-items: center; gap: 12px; }
.progress-row .progress { flex: 1; }
.progress-row .n { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Formulaires et filtres */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label, .lbl { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field input, .field select, .field textarea {
  min-height: var(--control); padding: 6px 16px; border: 1px solid var(--line-2); border-radius: var(--pill); background: #fff; width: 100%;
}
.field select { appearance: none; -webkit-appearance: none; padding-right: 36px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%235B655E' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center / 18px; }
.field textarea { min-height: 84px; resize: vertical; border-radius: var(--r-sm); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--sage-ink); outline: 2px solid var(--sage-ink); outline-offset: 0; }
.field input:read-only, .field textarea:read-only { background: var(--mist-2); color: var(--ink-2); }
.field .help { font-size: 12.5px; color: var(--ink-3); }
.filters { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; padding: 16px 20px; }

/* Puces en pilule */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 32px; padding: 3px 14px; border: 1px solid var(--line); border-radius: var(--pill); background: var(--surface); font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { background: var(--mist-2); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--sage-ink); border-color: var(--sage-ink); color: #fff; font-weight: 500; }

/* Tableaux : filets fins Mist, en-têtes en petites capitales */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 16px; border-top: 1px solid var(--line); vertical-align: top; }
td.num, td.nowrap { white-space: nowrap; }
thead th { border-top: 0; border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; padding: 14px 16px 10px; }
tbody tr:hover { background: var(--mist-2); }
td a.row-link { color: var(--ink); font-weight: 500; text-decoration: none; }
td a.row-link:hover { text-decoration: underline; }
td small { font-size: 12.5px; }
.empty { padding: 24px; text-align: center; color: var(--ink-3); }

/* Onglets segmentés en pilule */
.tabs { display: inline-flex; max-width: 100%; gap: 2px; padding: 4px; margin-bottom: 16px; background: var(--surface); border-radius: var(--pill); box-shadow: var(--shadow); overflow-x: auto; }
.tabs button { display: inline-flex; align-items: center; gap: 7px; border: 0; background: none; padding: 6px 16px; min-height: 36px; border-radius: var(--pill); font-weight: 500; color: var(--ink-2); white-space: nowrap; font-size: 13.5px; }
.tabs button svg { width: 16px; height: 16px; color: var(--ink-3); }
.tabs button:hover { background: var(--mist-2); color: var(--ink); }
.tabs button[aria-selected="true"] { background: var(--sage-ink); color: #fff; }
.tabs button[aria-selected="true"] svg { color: #fff; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 0 20px; margin: 0; font-size: 13.5px; }
.dl dt { color: var(--ink-2); padding: 6px 0; border-top: 1px solid var(--line); }
.dl dd { margin: 0; padding: 6px 0; border-top: 1px solid var(--line); }
.dl dt:first-of-type, .dl dd:first-of-type { border-top: 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 176px 1fr; gap: 4px 16px; }
.timeline li:first-child { border-top: 0; padding-top: 2px; }
.timeline .meta { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--ink-2); }
.timeline .meta .badge { align-self: flex-start; }
.timeline .body { min-width: 0; }
.timeline h3 { font-size: 13.5px; }
.timeline p { margin-top: 2px; font-size: 13.5px; }
.docs { list-style: none; margin: 0; padding: 0; }
.docs li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--line); }
.docs li:first-child { border-top: 0; }
.docs li svg { width: 16px; height: 16px; color: var(--ink-3); flex: none; margin-top: 3px; }
.docs li .t { flex: 1; min-width: 0; }
.docs li .t a { color: var(--ink); font-weight: 500; text-decoration: none; }
.docs li .t a:hover { text-decoration: underline; }
.docs li .t small { display: block; }

/* Dictée */
.modal-bg { position: fixed; inset: 0; background: rgba(30, 42, 34, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; padding: 0; }
.modal { background: var(--surface); width: 100%; max-width: 640px; max-height: 92dvh; overflow-y: auto; border-radius: var(--r) var(--r) 0 0; padding: 20px 24px calc(20px + var(--sat)); box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.modal-head h2 { flex: 1; font-size: 16px; }
.steps { display: flex; gap: 6px; margin-bottom: 10px; }
.steps span { flex: 1; height: 5px; border-radius: var(--pill); background: var(--mist); }
.steps span.on { background: var(--sage); }
.rec { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 13px; color: var(--ink-2); }
.rec .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); flex: none; }
.rec .mic { display: none; }
.rec strong { color: var(--ink); }
.bars { display: none; }
.transcript { padding: 12px 16px; border-radius: var(--r-sm); background: var(--mist-2); min-height: 96px; font-size: 13.5px; line-height: 1.55; }
.transcript .cursor { display: inline-block; width: 1px; height: 1em; background: var(--ink); vertical-align: text-bottom; margin-left: 1px; }
.cr { display: grid; gap: 12px; }
.cr .field textarea { min-height: 64px; }
.cr-taches { display: grid; gap: 8px; }
.modal .foot, .card .foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--r-sm); background: var(--mist-2); color: var(--ink); font-size: 13px; }
.note svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--sage-ink); }
.note.amber { background: #F6EBD9; }
.note.amber svg { color: var(--amber); }
.note.green svg { color: var(--sage-ink); }

/* Assistant : recherche documentaire */
.assistant { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.chat { display: flex; flex-direction: column; }
.chat-form { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.chat-form .search-pill { flex: 1; min-width: 0; }
.chat-form textarea { line-height: 1.4; max-height: 120px; }
.chat .msgs { display: grid; gap: 0; }
.msg { padding: 12px 0; border-top: 1px solid var(--line); }
.msg:first-child { border-top: 0; padding-top: 0; }
.msg .bubble { max-width: 76ch; }
.msg.me .bubble { font-size: 13px; color: var(--ink-2); }
.msg.me .bubble p { display: inline; }
.msg.me .bubble::before { content: "Recherche : "; font-weight: 600; }
.msg .bubble ul { margin: 6px 0 0; padding-left: 18px; }
.msg .bubble p + p { margin-top: 6px; }
.sources { margin-top: 12px; font-size: 13px; }
.sources strong { display: block; margin-bottom: 6px; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; font-weight: 500; color: var(--ink-2); }
.sources ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; counter-reset: src; }
.sources ol li { counter-increment: src; display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; background: var(--mist-2); border-radius: var(--r-sm); }
.sources ol li::before { content: counter(src); flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--sage-ink); color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center; }
.sources a { color: var(--ink); text-decoration: none; }
.sources a:hover { text-decoration: underline; }
.sugg { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 2px; }
.sugg button { border: 0; background: none; padding: 4px 0; text-align: left; color: var(--sage-ink); font-size: 13.5px; min-height: 28px; }
.sugg button:hover { text-decoration: underline; }
.thinking { font-size: 13px; color: var(--ink-3); }
.journal { list-style: none; margin: 0; padding: 0; }
.journal li { padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.journal li:first-child { border-top: 0; padding-top: 0; }
.journal li small { display: block; margin-top: 1px; font-size: 12px; }
.journal li button { border: 0; background: none; padding: 0; text-align: left; font-weight: 500; color: var(--ink); line-height: 1.4; min-height: 24px; }
.journal li button:hover { text-decoration: underline; }

/* Calendrier */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0; overflow: hidden; }
.day { padding: 12px 12px; min-height: 170px; min-width: 0; border-left: 1px solid var(--line); }
.day:first-child { border-left: 0; }
.day.today { background: var(--mist-2); }
.day h3 { font-size: 11px; letter-spacing: .15em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 8px; display: flex; justify-content: space-between; align-items: baseline; font-weight: 500; }
.day h3 .num { font-size: 16px; color: var(--ink); font-weight: 600; letter-spacing: 0; }
.day.today h3 .num { color: var(--sage-ink); }
.evt { display: block; padding: 4px 0 4px 10px; border-left: 2px solid var(--moss); font-size: 12.5px; line-height: 1.35; margin-bottom: 6px; color: var(--ink); text-decoration: none; }
.evt:hover { color: var(--sage-ink); }
.evt.haute { border-left-color: var(--amber); }
.evt.fait { border-left-color: var(--line); color: var(--ink-3); text-decoration: line-through; }
.evt small { display: block; color: var(--ink-2); font-size: 12px; }
.evt .who { display: inline-block; margin-top: 3px; font-size: 11.5px; }

/* Barres (équipe) */
.bars-h { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 170px 1fr 36px; gap: 10px; align-items: center; font-size: 13.5px; }
.bar-row .track { height: 10px; background: var(--mist); overflow: hidden; border-radius: var(--pill); }
.bar-row .fill { height: 100%; background: var(--sage); border-radius: var(--pill); }
.bar-row .n { text-align: right; font-weight: 600; }
.map-wrap { position: relative; }
.map-wrap svg { width: 100%; height: auto; display: block; }
.map-legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12.5px; color: var(--ink-2); margin-top: 8px; }
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.map-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.map-wrap .pt { cursor: pointer; }
.map-wrap .pt:hover circle, .map-wrap .pt:focus circle { stroke-width: 3; }
.map-tip { position: absolute; left: 8px; bottom: 8px; background: var(--surface); border-radius: var(--r-sm); padding: 6px 12px; font-size: 13px; max-width: calc(100% - 16px); box-shadow: var(--shadow); }

/* Administration : cartes profils */
.right-card ul { margin: 8px 0 0; padding-left: 18px; font-size: 13.5px; display: grid; gap: 2px; }
.profile { display: flex; align-items: center; gap: 14px; padding: 16px 16px 16px 18px; }
.profile .avatar { width: 52px; height: 52px; font-size: 15px; background: var(--moss); color: #fff; }
.profile .avatar i { position: absolute; top: 1px; right: 1px; width: 12px; height: 12px; border-radius: 50%; background: var(--sage); border: 2px solid var(--surface); }
.profile .avatar i.off { background: var(--grey); }
.profile .pinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.profile .pinfo strong { font-size: 14.5px; }
.profile .pinfo .role { color: var(--ink-2); font-size: 13px; }
.profile .pinfo small { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--sage); margin-right: 6px; vertical-align: middle; }
.status-dot.off { background: var(--grey); }

/* Notification : bandeau Mist, rond Sage à coche, croix */
.toast { position: fixed; left: 50%; bottom: calc(16px + var(--tabbar) + var(--sat)); transform: translateX(-50%); display: flex; align-items: center; gap: 12px; background: var(--mist); color: var(--ink); padding: 10px 10px 10px 12px; border-radius: 20px; font-size: 13.5px; z-index: 60; width: max-content; max-width: calc(100% - 32px); box-shadow: var(--shadow); }
.toast .ok { width: 36px; height: 36px; border-radius: 50%; background: var(--sage-ink); color: #fff; display: grid; place-items: center; flex: none; }
.toast .ok svg { width: 18px; height: 18px; }
.toast .txt { min-width: 0; line-height: 1.35; }
.toast .txt strong { display: block; font-size: 14px; }
.toast .txt span { color: var(--ink-2); font-size: 13px; }
.toast .fermer { width: 36px; height: 36px; border: 0; background: none; border-radius: 50%; color: var(--ink-2); display: grid; place-items: center; flex: none; }
.toast .fermer:hover { background: rgba(255, 255, 255, .5); color: var(--ink); }
.toast .fermer svg { width: 16px; height: 16px; }

/* Barre d'onglets mobile */
.tabbar { display: none; }
footer.foot { padding: 14px 24px calc(14px + var(--tabbar) + var(--sat)); font-size: 12.5px; color: var(--ink-3); text-align: center; }

/* Responsive */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: 1fr 1fr; }
  .assistant { grid-template-columns: 1fr; }
  .grid-main { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr; }
  .timeline .meta { flex-direction: row; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
}
@media (max-width: 1023px) {
  :root { --tabbar: 64px; --control: 44px; }
  body { font-size: 15px; }
  .btn-sm { min-height: 36px; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .search-global { display: none; }
  .user-btn .who { display: none; }
  .toggle .lbl-txt { display: none; }
  .topbar .brand { width: auto; min-width: 0; }
  .nav a, .sugg button, .journal li button { min-height: 44px; }
  .tabs button { min-height: 44px; }
  .chip { min-height: 40px; }
  .check { min-height: 44px; }
  .check input { width: 22px; height: 22px; margin-top: 10px; }
  .check label { padding-top: 10px; }
  .field input, .field select, .field textarea, .search-pill input, .search-pill textarea { font-size: 16px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--tabbar) + var(--sat)); padding-bottom: var(--sat); background: var(--surface); box-shadow: 0 -8px 24px rgba(60, 50, 40, .08);
  }
  .tabbar a, .tabbar button {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: none;
    font-size: 11px; font-weight: 500; color: var(--ink-2); text-decoration: none; min-height: 44px; padding-bottom: 6px;
  }
  .tabbar a svg, .tabbar button svg { width: 22px; height: 22px; color: var(--ink-2); }
  .tabbar a[aria-current="page"] { color: var(--sage-ink); }
  .tabbar a[aria-current="page"] svg { color: var(--sage-ink); }
  .tabbar a[aria-current="page"]::after { content: ""; position: absolute; bottom: 6px; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--sage-ink); }
  .sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-radius: var(--r) var(--r) 0 0; padding: 16px 16px calc(16px + var(--sat)); box-shadow: var(--shadow); }
  .week { grid-template-columns: 1fr; }
  .day { min-height: 0; border-left: 0; border-top: 1px solid var(--line); }
  .day:first-child { border-top: 0; }
  .day:empty { display: none; }
}
@media (max-width: 720px) {
  main.content { padding: 16px; }
  h1 { font-size: 18px; }
  .login-card { padding: 24px; }
  .card, .right-card { padding: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px 16px; }
  .kpi .val { font-size: 22px; }
  .filters { grid-template-columns: 1fr; padding: 16px; }
  /* Tableaux en lignes : data-label posé par app.js depuis les en-têtes */
  .table-wrap thead { display: none; }
  .table-wrap tr { display: block; padding: 10px 16px; border-top: 1px solid var(--line); }
  .table-wrap tr:first-child { border-top: 0; }
  .table-wrap td { display: block; position: relative; padding: 3px 0 3px 104px; border: 0; min-height: 24px; }
  .table-wrap td::before { content: attr(data-label); position: absolute; left: 0; top: 4px; width: 96px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; }
  .table-wrap td.num { white-space: normal; }
  .page-head .actions { margin-left: 0; width: 100%; }
  .page-head .actions .btn { flex: 1; }
  .dl { grid-template-columns: 1fr; gap: 0; }
  .dl dt { border-top: 1px solid var(--line); padding-bottom: 0; }
  .dl dd { border-top: 0; padding-top: 0; }
  .dl dd:first-of-type { border-top: 0; }
  .bar-row { grid-template-columns: 110px 1fr 36px; }
  .topbar { padding: 0 12px; gap: 6px; }
  .brand-text small { display: none; }
  .chat-form { flex-direction: column; align-items: stretch; }
  .chat-form .btn { width: 100%; }
  .toast { width: auto; left: 16px; right: 16px; transform: none; max-width: none; }
  .profile { padding: 14px; gap: 12px; }
}
@media (min-width: 721px) {
  .modal-bg { align-items: center; padding: 24px; }
  .modal { border-radius: var(--r); }
  .sheet { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
