/* Suivi de dossiers — interface */
:root {
  --bg: #eef2f8;
  --card: #ffffff;
  --card-2: #f6f8fc;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e3e8f1;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --accent-text: #ffffff;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn-bg: #fff7e0;
  --warn-text: #8a5a00;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 20px -6px rgba(15, 23, 42, .12);
  --shadow-lg: 0 18px 40px -14px rgba(30, 58, 138, .45);
  --radius: 16px;
  --tap: 46px;
  --rail: 44px;   /* largeur de la colonne de la ligne */
  --bar: 6px;     /* épaisseur de la ligne */
  --barx: 17px;   /* position de la ligne dans sa colonne */
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
:root[data-theme="dark"] {
    --bg: #0a0f1c;
    --card: #121a2b;
    --card-2: #172238;
    --text: #e5ebf5;
    --muted: #93a1b8;
    --line: #243250;
    --accent: #3b82f6;
    --accent-2: #2563eb;
    --warn-bg: #2f2408;
    --warn-text: #fcd34d;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -8px rgba(0, 0, 0, .5);
    --shadow-lg: 0 18px 40px -14px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }


*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}
body.locked { overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3 { letter-spacing: -.01em; }
.boot { padding: 40vh 16px 0; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.hidden { display: none !important; }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.svg-ico { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Barre du haut ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 4px;
  padding: calc(env(safe-area-inset-top, 0px) + 6px) 8px 6px;
  /* même couleur que le fond : la barre se fond dans la page (et dans la barre de titre de l'appli installée) */
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
body.scrolled .topbar { border-bottom-color: var(--line); }
.topbar h1 {
  flex: 1; min-width: 0; margin: 0 6px; font-size: 1.1rem; font-weight: 750;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin: 0 8px; flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.sync-dot.off { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 20%, transparent); }

.page { max-width: 880px; margin: 0 auto; padding: 16px 16px calc(120px + var(--safe-b)); }

/* ---------- Boutons ---------- */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap); height: var(--tap); border: 0; border-radius: 12px;
  background: transparent; cursor: pointer; flex: none; color: inherit;
}
.icon-btn:hover { background: color-mix(in srgb, var(--text) 7%, transparent); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 10px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); cursor: pointer;
  font-weight: 650; text-decoration: none; color: var(--text);
  box-shadow: var(--shadow-sm); touch-action: manipulation;
  transition: border-color .15s, background .15s, transform .1s;
}
.btn:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.btn:active { transform: scale(.98); }
.btn.primary { background: linear-gradient(180deg, var(--accent), var(--accent-2)); border-color: var(--accent-2); color: var(--accent-text); }
.btn.danger { color: var(--danger); }
.btn.danger.filled { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.block { width: 100%; }
.btn.small { min-height: 40px; padding: 7px 13px; font-size: .9rem; border-radius: 11px; }
.fab {
  position: fixed; right: 18px; bottom: calc(18px + var(--safe-b)); z-index: 15;
  display: inline-flex; align-items: center; gap: 8px;
  height: 56px; padding: 0 22px 0 18px; border: 0; border-radius: 28px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: #fff; font-weight: 700; font-size: 1rem;
  box-shadow: var(--shadow-lg); cursor: pointer;
}

/* ---------- Connexion ---------- */
.login {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%), var(--bg);
}
.login form { width: 100%; max-width: 380px; background: var(--card); padding: 30px 22px; border-radius: 22px; box-shadow: var(--shadow-lg); }
.login .logo { width: 68px; height: 68px; display: block; margin: 0 auto 12px; border-radius: 18px; box-shadow: var(--shadow); }
.login h1 { text-align: center; margin: 0 0 20px; font-size: 1.35rem; }

/* ---------- Formulaires ---------- */
.field { margin-bottom: 14px; }
.field > label { display: block; font-weight: 650; font-size: .9rem; margin-bottom: 6px; }
.input, textarea.input, select.input {
  width: 100%; min-height: var(--tap); padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card-2);
  font-size: 16px; /* évite le zoom automatique sur iPhone */
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; background: var(--card); }
textarea.input { min-height: 96px; resize: vertical; line-height: 1.45; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.check { display: flex; align-items: center; gap: 10px; min-height: var(--tap); cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }
.radio-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; margin-bottom: 8px; }
.radio-card input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); }
.radio-card:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--card)); }
.form-error { background: #fee2e2; color: #991b1b; padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; white-space: pre-line; }
:root[data-theme="dark"] .form-error { background: #3f1212; color: #fecaca; }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--card); cursor: pointer; box-shadow: 0 0 0 2px transparent; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--text); }

/* ---------- Liste des dossiers ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .input { flex: 1 1 220px; background: var(--card); }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 3px; box-shadow: var(--shadow-sm); }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; min-height: 38px; cursor: pointer; font-weight: 650; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }

.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.card {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 16px 14px 20px; cursor: pointer; text-align: left; width: 100%;
  display: block; color: inherit; text-decoration: none;
  transition: transform .15s, box-shadow .15s;
}
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: linear-gradient(180deg, #60a5fa, var(--accent-2)); }
.card.is-closed::before { background: linear-gradient(180deg, #94a3b8, #64748b); }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card h2 { margin: 0; font-size: 1.08rem; line-height: 1.3; overflow-wrap: anywhere; }
.card .meta { display: flex; align-items: center; gap: 6px; font-size: .84rem; color: var(--muted); margin-top: 4px; }
.card .meta .svg-ico { width: 15px; height: 15px; }
.card .desc { margin: 8px 0 0; font-size: .92rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-head { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.card-foot { display: flex; align-items: center; gap: 14px; font-size: .82rem; color: var(--muted); flex-wrap: wrap; }
.card-foot .stat { display: inline-flex; align-items: center; gap: 5px; }
.card-foot .stat .svg-ico { width: 15px; height: 15px; }
.card-foot .right { margin-left: auto; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .76rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: #dcfce7; color: #166534; white-space: nowrap; flex: none; }
.badge .svg-ico { width: 13px; height: 13px; }
.badge.closed { background: var(--card-2); color: var(--muted); border: 1px solid var(--line); }
:root[data-theme="dark"] .badge { background: #12341f; color: #86efac; }


/* Mini ligne de bus dans la carte */
.mini-line { position: relative; display: flex; align-items: center; justify-content: space-between; height: 24px; margin: 14px 2px 10px; }
.mini-line::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 5px; margin-top: -2.5px; border-radius: 3px; background: var(--line); }
.mini-line .fill { position: absolute; left: 0; top: 50%; height: 5px; margin-top: -2.5px; border-radius: 3px; background: linear-gradient(90deg, #60a5fa, var(--accent)); }
.mini-line i { position: relative; width: 13px; height: 13px; border-radius: 50%; background: var(--card); border: 3px solid var(--line); }
.mini-line i.on { border-color: var(--accent); }
.mini-line i.start.on { background: var(--accent); }
.mini-line i.end { border-radius: 4px; width: 15px; height: 15px; }
.mini-line i.end.on { background: var(--accent); }

.empty { text-align: center; padding: 50px 16px; color: var(--muted); }
.empty .svg-ico { width: 48px; height: 48px; margin-bottom: 8px; }

/* ---------- En-tête d'un dossier (bandeau) ---------- */
.hero {
  position: relative; overflow: hidden; color: #fff;
  background: radial-gradient(500px 200px at 100% 0%, rgba(255,255,255,.18), transparent 60%), linear-gradient(135deg, #1e3a8a 0%, #2563eb 60%, #3b82f6 100%);
  border-radius: 22px; padding: 18px 18px 16px; box-shadow: var(--shadow-lg); margin-bottom: 26px;
}
.hero.is-closed { background: linear-gradient(135deg, #334155, #475569 60%, #64748b); }
.hero-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.hero-badge { display: inline-flex; align-items: center; gap: 7px; font-size: .8rem; font-weight: 700; padding: 5px 11px; border-radius: 999px; background: rgba(255,255,255,.18); }
.hero-badge .svg-ico { width: 14px; height: 14px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgba(74, 222, 128, .35); }
.hero-edit { width: 40px; height: 40px; border-radius: 12px; border: 0; background: rgba(255,255,255,.15); color: #fff; display: grid; place-items: center; cursor: pointer; }
.hero-edit:hover { background: rgba(255,255,255,.25); }
.hero h2 { margin: 0 0 6px; font-size: 1.45rem; line-height: 1.25; overflow-wrap: anywhere; }
.hero-date { display: flex; align-items: center; gap: 6px; font-size: .88rem; opacity: .85; }
.hero-date .svg-ico { width: 15px; height: 15px; }
.hero-desc { margin: 10px 0 0; opacity: .95; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.hero-stats > div { background: rgba(255,255,255,.13); border-radius: 12px; padding: 8px 10px; }
.hero-stats b { display: block; font-size: 1.25rem; line-height: 1.2; }
.hero-stats span { font-size: .78rem; opacity: .85; }
.thermo { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.thermo-track { flex: 1; height: 10px; border-radius: 6px; background: rgba(255,255,255,.22); overflow: hidden; }
.thermo-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, #a7f3d0, #4ade80); transition: width .5s; }
.thermo > span { font-weight: 700; font-size: .9rem; min-width: 3.2em; text-align: right; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.legend-item {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  border: 0; border-radius: 999px; padding: 5px 11px 5px 7px; cursor: pointer;
  background: rgba(255,255,255,.95); color: #0f172a; font-size: .8rem; font-weight: 650;
}
.legend-item i { width: 12px; height: 12px; border-radius: 50%; background: var(--bc); flex: none; }
.legend-item.done { opacity: .75; }
.legend-item .svg-ico { width: 14px; height: 14px; color: #16a34a; }

/* ---------- Plan de ligne (ligne de bus) ---------- */
.map { padding: 0 0 8px; }
.line { position: relative; padding-left: var(--rail); --c: #2563eb; }
.line::before {
  content: ""; position: absolute; left: var(--barx); top: 14px; bottom: 26px; width: var(--bar);
  border-radius: var(--bar); background: var(--c);
}
.line.closed::before { bottom: 30px; }
.line.trunk::before { --bar: 8px; left: calc(var(--barx) - 1px); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 14%, transparent); }

.stop { position: relative; padding-bottom: 16px; }
/* station : rond blanc cerclé de la couleur de la ligne */
.stop > .dot {
  position: absolute; z-index: 1;
  left: calc(-1 * var(--rail) + var(--barx) + var(--bar) / 2 - 10px); top: 16px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--card); border: 5px solid var(--c);
  box-shadow: 0 0 0 3px var(--bg);
  display: grid; place-items: center;
}
.stop > .dot .svg-ico { width: 14px; height: 14px; stroke-width: 3; }

/* Départ et terminus */
.stop.terminal { padding-bottom: 22px; }
.stop.terminal > .dot { width: 28px; height: 28px; top: 4px; left: calc(-1 * var(--rail) + var(--barx) + var(--bar) / 2 - 14px); background: var(--c); border: 4px solid var(--card); box-shadow: 0 0 0 3px var(--c), 0 4px 10px -2px color-mix(in srgb, var(--c) 60%, transparent); color: #fff; }
.stop.terminal.end > .dot { border-radius: 9px; }
.terminal-label { display: flex; flex-direction: column; padding-top: 2px; }
.terminal-label strong { font-size: 1rem; }
.kicker { font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--c); }

/* Étape */
.step-card {
  position: relative; display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px 14px; color: inherit;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
/* petite flèche vers la station */
.step-card::before {
  content: ""; position: absolute; left: -7px; top: 19px; width: 12px; height: 12px;
  background: var(--card); border-left: 1px solid var(--line); border-bottom: 1px solid var(--line);
  transform: rotate(45deg); border-radius: 0 0 0 3px;
}
.step-card:hover { border-color: color-mix(in srgb, var(--c) 50%, var(--line)); transform: translateX(2px); }
.when { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.when-date { font-size: .78rem; font-weight: 700; color: var(--c); background: color-mix(in srgb, var(--c) 11%, transparent); padding: 2px 9px; border-radius: 999px; }
.when-time { font-size: .8rem; font-weight: 650; color: var(--muted); }
.step-card .title { font-weight: 700; font-size: 1.02rem; margin: 6px 0 0; overflow-wrap: anywhere; }
.step-card .desc { margin: 4px 0 0; font-size: .92rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; }
.thumbs { display: flex; gap: 6px; margin-top: 10px; }
.thumbs img { width: 54px; height: 54px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: var(--card-2); }
.more-thumbs { width: 54px; height: 54px; border-radius: 10px; display: grid; place-items: center; background: var(--card-2); color: var(--muted); font-weight: 700; font-size: .9rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; font-size: .8rem; padding: 4px 10px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--line); color: var(--text); text-decoration: none; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .svg-ico { width: 14px; height: 14px; }

/* Branche : raccord courbe depuis la ligne parente */
.fork { position: relative; padding-top: 28px; padding-bottom: 6px; }
.fork::before {
  content: ""; position: absolute; top: 0; height: 28px;
  left: calc(-1 * var(--rail) + var(--barx));
  width: calc(var(--rail) + var(--bar));
  border-top: var(--bar) solid var(--bc); border-right: var(--bar) solid var(--bc);
  border-top-right-radius: 26px;
}
/* départ de l'aiguillage sur la ligne parente */
.fork::after {
  content: ""; position: absolute; top: -7px; z-index: 1;
  left: calc(-1 * var(--rail) + var(--barx) + var(--bar) / 2 - 8px);
  width: 16px; height: 16px; border-radius: 50%; background: var(--bc); border: 3px solid var(--card);
  box-shadow: 0 0 0 2px var(--bc);
}
.fork > .line { --c: var(--bc); }
.fork > .line::before { top: 0; }

.stop.branch-start { padding-bottom: 18px; }
.stop.branch-start > .dot { top: 12px; width: 24px; height: 24px; left: calc(-1 * var(--rail) + var(--barx) + var(--bar) / 2 - 12px); background: var(--c); border: 4px solid var(--card); box-shadow: 0 0 0 3px var(--c); }
.branch-head {
  position: relative; padding: 10px 92px 12px 14px; border-radius: var(--radius);
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 13%, var(--card)), var(--card) 75%);
  border: 1px solid color-mix(in srgb, var(--c) 35%, var(--line));
  box-shadow: var(--shadow);
}
.branch-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.line-pill {
  display: inline-flex; align-items: center; gap: 7px; max-width: 100%;
  background: var(--c); color: #fff; font-weight: 750; font-size: .95rem;
  padding: 5px 13px 5px 10px; border-radius: 10px;
  box-shadow: 0 3px 8px -3px color-mix(in srgb, var(--c) 70%, transparent);
}
.line-pill span { overflow-wrap: anywhere; }
.line-pill .svg-ico { width: 16px; height: 16px; }
.state { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); }
.state.done { color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); }
.state .svg-ico { width: 13px; height: 13px; stroke-width: 3; }
.branch-meta { font-size: .82rem; color: var(--muted); margin-top: 7px; }
.branch-desc { margin: 6px 0 0; font-size: .92rem; }
.branch-tools { position: absolute; top: 4px; right: 4px; display: flex; }
.branch-toggle { width: var(--tap); height: var(--tap); border: 0; background: none; border-radius: 12px; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.branch-toggle:hover { background: color-mix(in srgb, var(--text) 7%, transparent); }
.branch-toggle .chev { transition: transform .2s; }
.collapsed-note { display: none; margin-top: 8px; border: 1px dashed color-mix(in srgb, var(--c) 50%, var(--line)); background: transparent; color: var(--c); border-radius: 10px; padding: 8px 12px; font-size: .85rem; font-weight: 650; cursor: pointer; min-height: 40px; }

/* Branche repliée */
.fork.collapsed > .line > :not(.branch-start) { display: none; }
.fork.collapsed > .line::before { bottom: auto; height: 60px; background: linear-gradient(var(--c), transparent); }
.fork.collapsed .branch-toggle .chev { transform: rotate(-90deg); }
.fork.collapsed .collapsed-note { display: inline-flex; }

/* Ajout en fin de ligne */
.stop.add { padding-bottom: 26px; }
.stop.add > .dot { border-style: dashed; border-width: 3px; color: var(--c); background: var(--card); top: 10px; }
.line-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.line-actions .btn .svg-ico { color: var(--c); }
.hint { background: var(--warn-bg); color: var(--warn-text); border-radius: 10px; padding: 8px 12px; font-size: .88rem; margin: 10px 0 0; }

/* ---------- Feuilles (fenêtres) ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(15, 23, 42, .5);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .15s ease-out;
}
.sheet {
  width: 100%; max-width: 620px; max-height: 92vh; max-height: 92dvh; overflow: auto;
  background: var(--card); border-radius: 22px 22px 0 0;
  padding: 6px 18px calc(18px + var(--safe-b));
  box-shadow: 0 -10px 40px rgba(0,0,0,.25);
  animation: up .22s cubic-bezier(.2, .8, .2, 1);
  overscroll-behavior: contain;
}
.sheet .grip { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 6px auto 8px; }
.sheet-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.sheet-head h3 { flex: 1; margin: 0; font-size: 1.15rem; }
.sheet-foot { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.sheet-foot .spacer { flex: 1; }
@media (min-width: 700px) {
  .sheet-backdrop { align-items: center; padding: 24px; }
  .sheet { border-radius: 22px; padding-bottom: 20px; }
  .sheet .grip { display: none; }
}
@keyframes up { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.menu { list-style: none; margin: 0; padding: 0; }
.menu button {
  width: 100%; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 10px;
  border: 0; background: none; border-radius: 12px; cursor: pointer; text-align: left; font-size: 1rem;
}
.menu button:hover { background: var(--card-2); }
.menu button.danger { color: var(--danger); }
.menu button:disabled { opacity: .45; cursor: not-allowed; }
.menu .sub { display: block; font-size: .82rem; color: var(--muted); }

/* Pièces jointes dans le formulaire */
.att-list { display: grid; gap: 10px; }
.att {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: start;
  border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: var(--card-2);
}
.att .thumb { width: 56px; height: 56px; border-radius: 8px; background: var(--line); display: grid; place-items: center; overflow: hidden; color: var(--muted); }
.att .thumb img { width: 100%; height: 100%; object-fit: cover; }
.att .name { font-weight: 600; font-size: .92rem; overflow-wrap: anywhere; }
.att .size { font-size: .8rem; color: var(--muted); }
.att textarea.input { min-height: 44px; margin-top: 6px; font-size: 16px; padding: 8px 10px; }
.att .acts { display: flex; flex-direction: column; gap: 2px; }
.att progress { width: 100%; margin-top: 6px; accent-color: var(--accent); }
.add-files { margin-top: 10px; }
.section-title { font-weight: 700; margin: 18px 0 8px; display: flex; align-items: center; gap: 6px; }

/* ---------- Réglages ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.panel h2 { margin: 0 0 12px; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.panel p { margin: 0 0 12px; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .95rem; }
.kv:last-child { border-bottom: 0; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Notifications ---------- */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + var(--safe-b)); z-index: 80; display: grid; gap: 8px; width: min(92vw, 460px); pointer-events: none; }
.toast { background: #0f172a; color: #fff; padding: 12px 16px; border-radius: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: up .2s ease-out; font-size: .95rem; }
.toast.error { background: var(--danger); }
.toast.ok { background: #15803d; }

@media (max-width: 480px) {
  :root { --rail: 38px; --barx: 13px; }
  .page { padding-left: 12px; padding-right: 12px; }
  .branch-head { padding-right: 88px; }
  .hero { padding: 16px 14px 14px; border-radius: 20px; }
  .hero h2 { font-size: 1.3rem; }
}
@media (hover: none) {
  .card:hover { transform: none; box-shadow: var(--shadow); }
  .step-card:hover { transform: none; border-color: var(--line); }
  .step-card:active, .card:active { transform: scale(.985); }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ======================= Échéances et suivi du temps ======================= */
:root { --late: #dc2626; --today: #ea580c; --soon: #d97706; --later: #2563eb; --done: #16a34a; }
:root[data-theme="dark"] { --late: #f87171; --today: #fb923c; --soon: #fbbf24; --later: #60a5fa; --done: #4ade80; }


.toast.warn { background: #b45309; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* Cloche */
.bell { position: relative; }
.bell-count {
  position: absolute; top: 6px; right: 5px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--late); color: #fff; font-size: .7rem; font-weight: 800;
  display: grid; place-items: center; box-shadow: 0 0 0 2px var(--card);
}

/* Pastilles d'échéance */
.due-chip {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  font-size: .78rem; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  color: var(--later); background: color-mix(in srgb, var(--later) 12%, transparent);
}
.due-chip .svg-ico { width: 14px; height: 14px; flex: none; }
.due-chip.soon { color: var(--soon); background: color-mix(in srgb, var(--soon) 14%, transparent); }
.due-chip.today { color: var(--today); background: color-mix(in srgb, var(--today) 14%, transparent); }
.due-chip.overdue { color: #fff; background: var(--late); }
.card-due { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* Bandeau du dossier */
.hero-due {
  display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 12px; border-radius: 12px;
  background: rgba(255,255,255,.14); font-size: .9rem;
}
.hero-due .svg-ico { width: 18px; height: 18px; }
.hero-due.overdue { background: rgba(220, 38, 38, .9); }
.hero-due.today, .hero-due.soon { background: rgba(234, 88, 12, .85); }
.hero-deadlines { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; padding: 5px 11px; border-radius: 999px; background: rgba(255,255,255,.16); font-size: .82rem; font-weight: 700; }
.hero-deadlines.late { background: rgba(220, 38, 38, .9); }
.hero-deadlines .svg-ico { width: 15px; height: 15px; }

/* Repère « Aujourd'hui » sur la ligne */
.stop.now-marker { padding-bottom: 18px; }
.stop.now-marker > .dot {
  width: 14px; height: 14px; top: 6px; border: 0; background: var(--late);
  left: calc(-1 * var(--rail) + var(--barx) + var(--bar) / 2 - 7px);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--late) 25%, transparent), 0 0 0 7px var(--bg);
}
.now-label { display: flex; align-items: center; gap: 10px; font-size: .8rem; font-weight: 800; color: var(--late); text-transform: uppercase; letter-spacing: .06em; }
.now-label::after { content: ""; flex: 1; height: 2px; background: repeating-linear-gradient(90deg, var(--late) 0 6px, transparent 6px 11px); opacity: .7; }
.now-label .muted { text-transform: none; letter-spacing: 0; font-weight: 600; }

/* Étape-échéance sur la ligne */
.stop.dl > .dot { width: 24px; height: 24px; top: 13px; left: calc(-1 * var(--rail) + var(--barx) + var(--bar) / 2 - 12px); border-width: 3px; border-radius: 8px; transform: rotate(45deg); color: var(--c); }
.stop.dl > .dot .svg-ico { transform: rotate(-45deg); width: 13px; height: 13px; stroke-width: 2.5; }
.stop.dl.overdue > .dot { border-color: var(--late); background: var(--late); color: #fff; }
.stop.dl.today > .dot, .stop.dl.soon > .dot { border-color: var(--today); color: var(--today); }
.stop.dl.done > .dot { border-color: var(--done); background: var(--done); color: #fff; }
.stop.dl > .step-card { border-style: dashed; border-width: 1.5px; background: color-mix(in srgb, var(--c) 3%, var(--card)); padding-right: 92px; }
.stop.dl.overdue > .step-card { border-color: color-mix(in srgb, var(--late) 60%, var(--line)); border-style: solid; background: color-mix(in srgb, var(--late) 6%, var(--card)); }
.stop.dl.today > .step-card, .stop.dl.soon > .step-card { border-color: color-mix(in srgb, var(--today) 55%, var(--line)); }
.stop.dl.done > .step-card { border-style: solid; opacity: .78; }
.stop.dl.done .title { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--text) 40%, transparent); }
.stop.dl > .step-card::before { border-style: solid; border-width: 0 0 1.5px 1.5px; border-color: inherit; background: inherit; top: 18px; }
.kind-tag { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.kind-tag .svg-ico { width: 13px; height: 13px; }
.due-line { margin-top: 6px; font-size: .84rem; font-weight: 750; color: var(--later); }
.due-line.soon { color: var(--soon); }
.due-line.today { color: var(--today); }
.due-line.overdue { color: var(--late); }
.due-line.done { color: var(--done); }
.step-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.step-card.flash, .stop.flash > .step-card { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 45%, transparent); } 100% { box-shadow: var(--shadow); } }

.done-btn {
  position: absolute; top: 10px; right: 10px; z-index: 1;
  display: inline-flex; align-items: center; gap: 5px; min-height: 40px; padding: 6px 12px;
  border-radius: 11px; border: 1.5px solid var(--done); background: var(--card); color: var(--done);
  font-weight: 750; font-size: .85rem; cursor: pointer;
}
.done-btn:hover { background: color-mix(in srgb, var(--done) 10%, var(--card)); }
.done-btn.is-done { background: var(--done); color: #fff; }
.done-btn .svg-ico { width: 16px; height: 16px; stroke-width: 3; }

.branch-due { margin-top: 8px; }

/* Formulaires */
.kind-seg { display: flex; width: 100%; margin-bottom: 14px; }
.kind-seg button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; }
.kind-seg .svg-ico { width: 17px; height: 17px; }
.reminders { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-check { position: relative; cursor: pointer; }
.pill-check input { position: absolute; opacity: 0; pointer-events: none; }
.pill-check span { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card-2); font-size: .9rem; font-weight: 600; }
.pill-check input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.pill-check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.deadline-section .field > label { display: flex; align-items: center; gap: 4px; }
.due-box { margin: 4px 0 12px; padding: 4px 12px; border: 1px dashed var(--line); border-radius: 12px; }
.due-box .check .svg-ico { color: var(--soon); }
.due-box .row { padding-bottom: 4px; }
.done-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 12px; margin-bottom: 14px; background: color-mix(in srgb, var(--soon) 12%, transparent); font-weight: 650; }
.done-row.is-done { background: color-mix(in srgb, var(--done) 12%, transparent); }
.sub-title { display: flex; align-items: center; gap: 8px; font-size: .95rem; margin: 18px 0 6px; }
.sub-title:first-child { margin-top: 0; }
.ics-row .input { font-size: .85rem; }

/* Échéancier */
.agenda-group { margin-bottom: 22px; }
.agenda-group h2 { display: flex; align-items: center; gap: 8px; font-size: .82rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 10px 4px; }
.agenda-group .count { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; display: grid; place-items: center; background: var(--line); color: var(--text); font-size: .75rem; letter-spacing: 0; }
.agenda-group.overdue h2 { color: var(--late); }
.agenda-group.overdue .count { background: var(--late); color: #fff; }
.agenda-group.today h2 { color: var(--today); }
.agenda-group.today .count { background: var(--today); color: #fff; }
.agenda-item {
  position: relative; display: flex; align-items: stretch; margin-bottom: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.agenda-item.overdue { border-color: color-mix(in srgb, var(--late) 45%, var(--line)); }
.agenda-main { flex: 1; min-width: 0; display: flex; gap: 12px; align-items: stretch; padding: 12px 12px 12px 0; border: 0; background: none; text-align: left; cursor: pointer; }
.agenda-bar { width: 6px; flex: none; border-radius: 0 4px 4px 0; background: var(--c, var(--muted)); }
.agenda-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.agenda-text strong { overflow-wrap: anywhere; }
.agenda-where { font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.agenda-when { display: inline-flex; align-items: center; gap: 5px; font-size: .82rem; font-weight: 700; color: var(--later); margin-top: 2px; }
.agenda-when .svg-ico { width: 14px; height: 14px; }
.agenda-item.overdue .agenda-when { color: var(--late); }
.agenda-item.today .agenda-when, .agenda-item.soon .agenda-when { color: var(--today); }
.agenda-item.idle .agenda-when { color: var(--muted); }
.agenda-item .done-btn { position: static; align-self: center; margin-right: 10px; }

/* ======================= v1.3 : équipe, insertion, liens, recherche, réunions ======================= */

/* Personnes */
.avatar {
  --uc: #2563eb;
  display: inline-grid; place-items: center; flex: none;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--uc); color: #fff; font-size: .72rem; font-weight: 800; letter-spacing: .02em;
  box-shadow: 0 0 0 2px var(--card); user-select: none;
}
.avatar.xs { width: 22px; height: 22px; font-size: .62rem; }
.avatar.lg { width: 52px; height: 52px; font-size: 1.1rem; }
.avatar.inactive { filter: grayscale(1); opacity: .6; }
.avatar.inherited { background: var(--card); color: var(--uc); box-shadow: inset 0 0 0 2px var(--uc), 0 0 0 2px var(--card); }
.avatars { display: inline-flex; }
.avatars .avatar + .avatar { margin-left: -7px; }
.person-chip { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; min-width: 0; }
.person-chip .avatar { width: 22px; height: 22px; font-size: .62rem; }
.card-badges { display: inline-flex; align-items: center; gap: 8px; flex: none; }
.step-people { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; color: var(--muted); }
.hero-people { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; }
.hero-people .person-chip { background: rgba(255,255,255,.14); padding: 3px 10px 3px 3px; border-radius: 999px; }
.hero-people .avatar { box-shadow: 0 0 0 2px rgba(255,255,255,.6); }
.hero-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font-size: .85rem; }
.hero-links .svg-ico { width: 16px; height: 16px; }
.hero-link { border: 0; border-radius: 999px; padding: 4px 11px; background: rgba(255,255,255,.95); color: #0f172a; font-weight: 650; font-size: .8rem; cursor: pointer; }
.person-pill span { gap: 6px; padding-left: 6px; }
.person-pill .avatar { box-shadow: none; }

/* Barre de navigation du bas */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: center; gap: 4px;
  padding: 6px 8px calc(6px + var(--safe-b));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--line);
}
.nav-item {
  flex: 1; max-width: 140px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: 52px; padding: 6px 4px; border-radius: 14px; text-decoration: none; color: var(--muted);
  font-size: .74rem; font-weight: 700;
}
.nav-item:hover { color: var(--text); }
.nav-item.active { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.nav-ico { position: relative; display: grid; place-items: center; }
.nav-ico .svg-ico { width: 23px; height: 23px; }
.nav-ico .bell-count { top: -6px; right: -12px; box-shadow: 0 0 0 2px var(--bg); }
body.has-nav .page { padding-bottom: calc(150px + var(--safe-b)); }
body.has-nav .fab { bottom: calc(80px + var(--safe-b)); }
body.has-nav #toasts { bottom: calc(150px + var(--safe-b)); }

/* Recherche */
.search-input { padding-left: 14px; }
.search-results { display: grid; gap: 12px; }
.search-count { margin: 0 4px; }
.result-group { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.result-group.is-closed { opacity: .85; }
.result-head {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 12px 14px; border: 0; cursor: pointer; text-align: left;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, var(--card)), var(--card)); font-weight: 750; font-size: 1rem;
}
.result-head.static { cursor: default; }
.result-head-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.result-head .svg-ico { color: var(--accent); }
.svg-ico.go { width: 18px; height: 18px; color: var(--muted); }
.result-group > .result-snippet { margin: 0; padding: 0 14px 10px; font-size: .88rem; color: var(--muted); }
.result-hit {
  --c: var(--accent);
  width: 100%; display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border: 0; border-top: 1px solid var(--line);
  background: none; text-align: left; cursor: pointer; min-height: 52px;
}
.result-hit:hover { background: var(--card-2); }
.result-ico { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); }
.result-ico .svg-ico { width: 16px; height: 16px; }
.result-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.result-text strong { overflow-wrap: anywhere; }
.result-kind { font-size: .74rem; font-weight: 700; color: var(--c); }
.result-text .result-snippet { font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
mark { background: color-mix(in srgb, #facc15 55%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* Insérer entre deux éléments */
.stop.insert { height: 34px; padding: 0; z-index: 2; margin-top: -4px; }
.insert-btn {
  position: absolute; top: 2px; left: calc(-1 * var(--rail) + var(--barx) + var(--bar) / 2 - 11px);
  width: 22px; height: 22px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--c); background: var(--card); color: var(--c);
  display: grid; place-items: center; transition: transform .15s, background .15s;
  box-shadow: 0 0 0 3px var(--bg);
}
.insert-btn::after { content: ""; position: absolute; inset: -9px -12px; } /* zone tactile plus large */
.insert-btn .svg-ico { width: 13px; height: 13px; stroke-width: 3; }
.stop.insert.before-fork { height: 46px; }
.stop.insert.before-fork .insert-btn { top: 4px; }
.insert-label {
  position: absolute; top: 1px; left: 0; display: none; border: 0; cursor: pointer;
  font-size: .75rem; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: var(--c); color: #fff;
}
.stop.insert:hover .insert-btn, .insert-btn:focus-visible { transform: scale(1.12); background: var(--c); color: #fff; }
.stop.insert:hover .insert-label { display: inline-block; }
.stop.insert.before-fork .insert-label { top: 3px; }

/* Correspondance vers un autre dossier */
.stop.link > .dot { width: 26px; height: 26px; top: 12px; left: calc(-1 * var(--rail) + var(--barx) + var(--bar) / 2 - 13px); border-width: 3px; color: var(--c); }
.stop.link > .dot .svg-ico { width: 13px; height: 13px; stroke-width: 2.6; }
.link-card {
  position: relative; display: block; cursor: pointer; padding: 11px 50px 11px 14px; border-radius: var(--radius);
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 7%, var(--card)) 0 10px, var(--card) 10px 20px);
  border: 1.5px solid color-mix(in srgb, var(--c) 45%, var(--line)); box-shadow: var(--shadow);
}
.link-card:hover { border-color: var(--c); }
.link-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.link-card .title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 750; margin-top: 6px; overflow-wrap: anywhere; }
.link-card .desc { font-size: .9rem; color: var(--muted); margin-top: 2px; }
.link-go { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; font-size: .82rem; font-weight: 700; color: var(--c); }
.link-go .svg-ico { width: 16px; height: 16px; }
.link-del { position: absolute; top: 2px; right: 2px; color: var(--muted); }
.link-card.flash { animation: flash 1.6s ease-out; }
.branch-head.flash { animation: flash 1.6s ease-out; }

/* Choix d'un dossier */
.pick-list { display: grid; gap: 6px; max-height: 280px; overflow: auto; margin-top: 8px; padding: 2px; }
.pick { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.pick input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.pick span:not(.badge) { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pick:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--card)); }

.badge.warn { background: var(--warn-bg); color: var(--warn-text); }
.field.narrow { flex: 0 0 110px; }
.svg-ico.inline { width: 16px; height: 16px; vertical-align: -3px; margin-right: 5px; }
.agenda-av { align-self: center; margin-right: 12px; }
.btn.is-on { background: color-mix(in srgb, var(--done) 14%, var(--card)); border-color: var(--done); color: var(--done); }
.section-head { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; margin: 0 0 12px; }

/* Réglages */
.theme-seg { display: flex; width: 100%; }
.theme-seg button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.theme-seg .svg-ico { width: 17px; height: 17px; }
.profile-preview { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.team-list { display: grid; }
.team-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.team-row:last-child { border-bottom: 0; }
.team-row.inactive { opacity: .6; }
.team-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* Réunions */
.meeting-card { display: flex; gap: 14px; align-items: flex-start; }
.meeting-card::before { background: linear-gradient(180deg, #2dd4bf, #0f766e); }
.meeting-date {
  flex: none; width: 54px; padding: 6px 0; border-radius: 12px; text-align: center;
  background: color-mix(in srgb, #0f766e 12%, var(--card)); color: #0f766e;
}
:root[data-theme="dark"] .meeting-date { color: #5eead4; }
.meeting-date b { display: block; font-size: 1.4rem; line-height: 1.1; }
.meeting-date span { font-size: .75rem; font-weight: 700; text-transform: uppercase; }
.meeting-info { flex: 1; min-width: 0; display: grid; gap: 2px; }
.meeting-info .card-foot { margin-top: 8px; }
.meeting-hero { background: radial-gradient(500px 200px at 100% 0%, rgba(255,255,255,.18), transparent 60%), linear-gradient(135deg, #134e4a 0%, #0f766e 55%, #14b8a6 100%); }
.meeting-hero .hero-date { margin-top: 2px; }
.hero-stats .over b { color: #fecaca; }
.meeting-agenda, .suggestions { margin-bottom: 26px; }
.mi-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 12px; }
.mi {
  --c: #0f766e;
  display: flex; gap: 12px; padding: 14px; background: var(--card); border: 1px solid var(--line);
  border-left: 5px solid var(--c); border-radius: var(--radius); box-shadow: var(--shadow);
}
.mi.done { opacity: .75; }
.mi.done .mi-title { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--text) 40%, transparent); }
.mi-num { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: #fff; font-weight: 800; }
.mi-body { flex: 1; min-width: 0; }
.mi-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mi-title { font-size: 1.02rem; overflow-wrap: anywhere; }
.mi-ref {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; margin-top: 6px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--c) 35%, var(--line)); background: color-mix(in srgb, var(--c) 7%, var(--card));
  font-size: .82rem; font-weight: 650; cursor: pointer; text-align: left; color: var(--text);
}
.mi-ref.static { cursor: default; color: var(--muted); }
.mi-ref span { overflow-wrap: anywhere; }
.mi-ref .svg-ico { width: 15px; height: 15px; color: var(--c); }
.mi-block { margin-top: 10px; padding: 8px 12px; border-radius: 10px; background: var(--card-2); font-size: .93rem; }
.mi-block.outcome { background: color-mix(in srgb, var(--done) 10%, var(--card)); }
.mi-label { display: block; font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.mi-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.mi-side { flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.mi-side .icon-btn { width: 38px; height: 38px; color: var(--muted); }
.mi-side .icon-btn:disabled { opacity: .25; cursor: default; }
.suggest {
  --c: #2563eb;
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 8px;
  background: var(--card); border: 1px dashed color-mix(in srgb, var(--c) 40%, var(--line)); border-radius: 14px;
}
.suggest-tag { flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 800; padding: 3px 8px; border-radius: 999px; color: var(--later); background: color-mix(in srgb, var(--later) 12%, transparent); }
.suggest-tag .svg-ico { width: 13px; height: 13px; }
.suggest.late .suggest-tag { color: #fff; background: var(--late); }
.suggest.deadline .suggest-tag { color: var(--soon); background: color-mix(in srgb, var(--soon) 14%, transparent); }
.suggest.activity .suggest-tag { color: var(--done); background: color-mix(in srgb, var(--done) 13%, transparent); }
.suggest.idle .suggest-tag { color: var(--muted); background: var(--card-2); }
.suggest-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.suggest-text strong { overflow-wrap: anywhere; }
@media (max-width: 480px) {
  .suggest { flex-wrap: wrap; }
  .suggest-text { flex-basis: calc(100% - 100px); }
  .mi { padding: 12px 10px; gap: 10px; }
}

/* Impression (ordre du jour, compte rendu) */
@media print {
  :root { --bg: #fff; --card: #fff; --card-2: #f4f4f5; --text: #000; --muted: #444; --line: #ccc; }
  body { background: #fff; }
  .topbar, .bottom-nav, .fab, #toasts, .no-print, .sheet-backdrop, .insert-btn, .stop.insert, .stop.add { display: none !important; }
  .page { padding: 0; max-width: none; }
  .hero { color: #000; background: none !important; box-shadow: none; border: 2px solid #000; }
  .hero-stats > div, .hero-people .person-chip { background: #f4f4f5; }
  .mi, .panel, .step-card, .link-card, .result-group { box-shadow: none; break-inside: avoid; }
  .avatar { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* ======================= Statut « en attente » ======================= */
:root { --wait: #9333ea; }
:root[data-theme="dark"] { --wait: #c084fc; }
.toolbar .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.toolbar .seg::-webkit-scrollbar { display: none; }
.seg button { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.seg-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-grid; place-items: center; font-size: .72rem; background: color-mix(in srgb, var(--text) 9%, transparent); }
.seg button[aria-pressed="true"] .seg-count { background: rgba(255,255,255,.25); }
.badge.waiting { background: color-mix(in srgb, var(--wait) 14%, var(--card)); color: var(--wait); }
.card.is-waiting::before { background: linear-gradient(180deg, #c084fc, #7e22ce); }
.card-wait { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; font-size: .88rem; color: var(--wait); }
.card-wait > .svg-ico { width: 16px; height: 16px; }
.card-wait > span:first-of-type { color: var(--text); }

.waiting-intro { grid-column: 1 / -1; }
.party-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.party-chips.small { margin-top: 8px; }
.party-chip {
  display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--wait) 35%, var(--line)); background: var(--card); font-weight: 650; font-size: .9rem; color: var(--text);
}
.party-chips.small .party-chip { min-height: 34px; font-size: .84rem; }
.party-chip b { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-grid; place-items: center; font-size: .72rem; background: color-mix(in srgb, var(--wait) 14%, transparent); color: var(--wait); }
.party-chip[aria-pressed="true"] { background: var(--wait); border-color: var(--wait); color: #fff; }
.party-chip[aria-pressed="true"] b { background: rgba(255,255,255,.25); color: #fff; }
.cards:has(> .waiting-intro) { display: block; }
.waiting-intro { margin-bottom: 18px; }
.party-group { margin-bottom: 22px; }
.party-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin: 0 0 10px 2px; font-size: 1.02rem; }
.party-ico { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--wait) 14%, transparent); color: var(--wait); }
.party-ico .svg-ico { width: 17px; height: 17px; }
.party-name { font-weight: 800; }

.hero-badge.waiting { background: rgba(250, 245, 255, .95); color: #7e22ce; }
.wait-box { margin-top: 12px; padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,.14); }
.wait-box:not(.idle) { background: rgba(255,255,255,.96); color: #1e1b4b; }
.wait-box.idle { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 6px; background: transparent; }
.wait-main { display: flex; gap: 10px; align-items: flex-start; }
.wait-ico { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: #f3e8ff; color: #7e22ce; }
.wait-title { font-size: .95rem; }
.wait-sub { font-size: .82rem; color: #475569; }
.wait-relance { font-weight: 700; color: #7e22ce; }
.wait-relance.overdue { color: #dc2626; }
.wait-note { margin-top: 4px; font-size: .88rem; color: #334155; }
.wait-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.wait-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px; border-radius: 11px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.5); background: rgba(255,255,255,.14); color: #fff; font-weight: 700; font-size: .88rem;
}
.wait-btn .svg-ico { width: 16px; height: 16px; }
.wait-box:not(.idle) .wait-btn { border-color: #d8b4fe; background: #fff; color: #6b21a8; }
.wait-box:not(.idle) .wait-btn.primary { background: #7e22ce; border-color: #7e22ce; color: #fff; }
.wait-hist { font-size: .8rem; opacity: .8; }

/* ---------- Attente par branche ---------- */
.wait-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.wait-entry {
  position: relative; display: flex; flex-direction: column; gap: 6px; cursor: pointer;
  padding: 12px 14px 12px 18px; border-radius: var(--radius); background: var(--card);
  border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden;
}
.wait-entry::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c, var(--wait)); }
.wait-entry:hover, .wait-entry:focus-visible { border-color: color-mix(in srgb, var(--wait) 45%, var(--line)); }
.wait-entry-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wait-entry-title { font-size: 1rem; overflow-wrap: anywhere; }
.wait-entry-note { font-size: .88rem; color: var(--muted); overflow-wrap: anywhere; }
.wait-entry-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.wait-scope {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  font-size: .8rem; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  color: var(--wait); background: color-mix(in srgb, var(--wait) 12%, transparent);
}
.wait-scope.branch { color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); }
.wait-scope .svg-ico { width: 14px; height: 14px; flex: none; }
.still-active { font-size: .76rem; font-weight: 650; padding: 2px 8px; border-radius: 999px; color: var(--accent, #2563eb); background: color-mix(in srgb, var(--accent, #2563eb) 11%, transparent); }
.card-wait.partial { opacity: .9; }
.card-wait.partial > .svg-ico { opacity: .7; }

.state.waiting { color: var(--wait); background: color-mix(in srgb, var(--wait) 13%, transparent); }
.line.waiting::before {
  background: repeating-linear-gradient(180deg, var(--c) 0 10px, color-mix(in srgb, var(--c) 30%, transparent) 10px 18px);
}
.wait-box.in-branch {
  margin-top: 10px; background: color-mix(in srgb, var(--wait) 7%, var(--card)); color: var(--text);
  border: 1px solid color-mix(in srgb, var(--wait) 30%, var(--line));
}
.wait-box.in-branch .wait-ico { width: 30px; height: 30px; background: color-mix(in srgb, var(--wait) 15%, transparent); color: var(--wait); }
.wait-box.in-branch .wait-sub, .wait-box.in-branch .wait-note { color: var(--muted); }
.wait-box.in-branch .wait-relance { color: var(--wait); }
.wait-box.in-branch .wait-relance.overdue { color: #dc2626; }
.wait-box.in-branch .wait-btn { border-color: color-mix(in srgb, var(--wait) 40%, var(--line)); background: var(--card); color: var(--wait); }
.wait-box.in-branch .wait-btn.primary { background: var(--wait); border-color: var(--wait); color: #fff; }
.branch-head .wait-box.in-branch { margin-right: -78px; }
@media (max-width: 640px) { .branch-head .wait-box.in-branch { margin-right: -74px; } }
.line-actions .wait-action { color: var(--wait); border-color: color-mix(in srgb, var(--wait) 40%, var(--line)); }
.line-actions .wait-action .svg-ico { color: var(--wait); }

/* ---------- Filtre par personne et dossiers confidentiels ---------- */
:root { --conf: #b45309; }
:root[data-theme="dark"] { --conf: #fbbf24; }
.person-filter { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 2px 0; }
.person-filter::-webkit-scrollbar { display: none; }
.person-filter-label { flex: none; font-size: .82rem; font-weight: 700; color: var(--muted); }
.person-chip {
  flex: none; display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 5px 13px 5px 6px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); font-weight: 650; font-size: .88rem; color: var(--text);
}
.person-chip:not(:has(.avatar)) { padding-left: 13px; }
.person-chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.person-chip[aria-pressed="true"] .avatar { box-shadow: 0 0 0 2px var(--bg); }
.badge.confidential { background: color-mix(in srgb, var(--conf) 14%, var(--card)); color: var(--conf); }
@media (max-width: 420px) { .card-badges .badge.confidential .badge-text { display: none; } }
.hero-badge.confidential { background: rgba(254, 243, 199, .95); color: #92400e; }
.hero-top .hero-badge.confidential { margin: 0 auto 0 8px; }
.conf-box { margin-top: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--conf) 30%, var(--line)); background: color-mix(in srgb, var(--conf) 6%, var(--card)); }
.conf-box .check .svg-ico { color: var(--conf); width: 18px; height: 18px; }
.conf-box p { margin: 6px 0 0; }
.link-btn { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 4px 0; cursor: pointer; color: var(--conf); font-weight: 650; text-decoration: underline; text-underline-offset: 2px; }
.link-btn.small { font-size: .82rem; }
.team-name .link-btn { display: flex; }
.stop.link.hidden-target .link-card { opacity: .75; cursor: not-allowed; }

/* ---------- Réunions : actions, prise de notes, transformation en dossier ---------- */
.section-head .count { margin-left: 4px; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; display: inline-grid; place-items: center; background: var(--line); color: var(--text); font-size: .75rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.hero-btn { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.35); color: #fff; text-decoration: none; }
.hero-btn.primary { background: #fff; border-color: #fff; color: #0f172a; }
.minutes-view { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; line-height: 1.55; }

.ma-list { display: grid; gap: 8px; margin: 10px 0; }
.ma { display: flex; align-items: flex-start; gap: 10px; padding: 10px 6px 10px 10px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.mi .ma { background: var(--card-2); }
.ma-check { flex: none; width: 30px; height: 30px; border-radius: 9px; border: 2px solid var(--line); background: var(--card); color: transparent; display: grid; place-items: center; cursor: pointer; margin-top: 1px; }
.ma-check .svg-ico { width: 18px; height: 18px; stroke-width: 3; }
.ma-check[aria-pressed="true"] { background: var(--done); border-color: var(--done); color: #fff; }
.ma-body { flex: 1; min-width: 0; }
.ma-title { font-weight: 650; overflow-wrap: anywhere; }
.ma.done .ma-title { text-decoration: line-through; color: var(--muted); }
.ma-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 5px; font-size: .82rem; }
.ma-who { display: inline-flex; align-items: center; gap: 5px; }
.ma .icon-btn { flex: none; }
.link-btn.accent { color: var(--accent); }

.quick-action { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; padding: 8px; border-radius: 12px; border: 1px dashed color-mix(in srgb, var(--accent) 40%, var(--line)); background: color-mix(in srgb, var(--accent) 4%, var(--card)); }
.quick-action > .input { flex: 1 1 200px; min-width: 0; }
.qa-ico { flex: none; color: var(--accent); display: grid; place-items: center; }
.qa-opts { display: flex; gap: 8px; flex: 1 1 100%; }
.qa-opts .input { flex: 1 1 0; min-width: 0; padding-left: 8px; padding-right: 8px; }
.qa-opts .btn { flex: none; }
@media (min-width: 700px) { .qa-opts { flex: 0 1 auto; } .qa-opts .input { width: 150px; } }

.save-state { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; font-weight: 650; color: var(--done); padding: 0 6px; white-space: nowrap; }
.save-state .svg-ico { width: 15px; height: 15px; }
.save-state.saving { color: var(--muted); }
.live-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.live-top h2 { margin: 0; font-size: 1.25rem; }
.live-clock { font-size: .85rem; font-weight: 650; color: var(--muted); }
.live-clock.over { color: var(--late); }
.live-points { display: grid; gap: 14px; margin: 14px 0; }
.live-point { --c: var(--accent); background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--c); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.live-point.done { border-left-color: var(--done); }
.live-point.general { --c: #0f766e; margin-top: 14px; }
.live-point.general .mi-num .svg-ico { width: 16px; height: 16px; }
.live-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.live-head strong { font-size: 1.02rem; overflow-wrap: anywhere; }
.live-ref { flex: 1 1 100%; padding-left: 40px; margin-top: -6px; }
.live-prep { margin: 0 0 10px; font-size: .88rem; }
.live-prep summary { cursor: pointer; color: var(--muted); font-weight: 650; }
.live-prep > div { margin-top: 6px; padding: 8px 10px; border-radius: 10px; background: var(--card-2); }
.live-text { width: 100%; min-height: 90px; resize: vertical; line-height: 1.5; font-size: 1rem; }
.live-text.minutes { min-height: 180px; }
.live-foot { display: flex; justify-content: flex-end; margin-top: 10px; }
.live-add { display: flex; gap: 8px; }
.live-add .input { flex: 1; min-width: 0; }
.live-end { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); margin-top: 16px; background: linear-gradient(transparent, var(--bg) 30%); }

.wizard-page .seg { margin-bottom: 12px; }
.plan { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin: 10px 0 12px; }
.plan-row { --d: 0; min-width: 0; margin-left: calc(min(var(--d), 5) * 18px); padding: 8px 8px 6px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); border-left: 4px solid var(--line); }
.plan-row.t-branch { border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, var(--card)); }
.plan-row.t-action { border-left-color: #0f766e; }
.plan-row.off { opacity: .45; }
.plan-line { display: flex; align-items: center; gap: 8px; }
.plan-line input[type="checkbox"] { flex: none; width: 20px; height: 20px; }
.plan-ico { flex: none; display: grid; place-items: center; color: var(--muted); }
.t-branch .plan-ico { color: var(--accent); }
.t-action .plan-ico { color: #0f766e; }
.plan-title { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-weight: 650; color: var(--text); padding: 6px 4px; border-radius: 8px; }
.plan-title:focus { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); background: var(--card-2); }
.plan-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0; margin-top: 2px; padding-left: 24px; }
.plan-type { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 8px; font-size: .8rem; padding: 4px 6px; margin-right: 4px; }
.icon-btn.sm { width: 31px; height: 32px; border-radius: 9px; }
.icon-btn.sm .svg-ico { width: 16px; height: 16px; }
.plan-tools .icon-btn.sm:first-of-type .svg-ico { transform: none; }
.plan-meta { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; color: var(--muted); margin-left: 4px; }
.plan-note { flex: 1 1 100%; font-size: .78rem; color: var(--muted); font-style: italic; }
.wizard-foot { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); }
.plan-summary { font-size: .85rem; font-weight: 650; color: var(--muted); }
@media print { .live-end, .wizard-foot, .quick-action, .ma .icon-btn { display: none !important; } }

/* ---------- Dossiers urgents ---------- */
.badge.urgent { background: var(--late); color: #fff; }
.card.is-urgent { border-color: color-mix(in srgb, var(--late) 45%, var(--line)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--late) 25%, transparent), var(--shadow); }
.card.is-urgent::before { background: linear-gradient(180deg, #f87171, #b91c1c); }
.hero-badge.urgent { background: #dc2626; color: #fff; }
.hero-top .hero-badge.urgent { margin: 0 0 0 8px; }
.hero-top .hero-badge.urgent + .hero-badge.confidential { margin-left: 6px; }
.hero-top .hero-badge.urgent:not(:has(+ .hero-badge.confidential)) { margin-right: auto; }
.urgent-filter { flex: 1 1 100%; display: flex; }
.urgent-filter:empty { display: none; }
.urgent-chip {
  display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 5px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--late) 40%, var(--line)); background: var(--card); color: var(--late); font-weight: 700; font-size: .88rem;
}
.urgent-chip b { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-grid; place-items: center; font-size: .72rem; background: color-mix(in srgb, var(--late) 14%, transparent); }
.urgent-chip[aria-pressed="true"] { background: var(--late); border-color: var(--late); color: #fff; }
.urgent-chip[aria-pressed="true"] b { background: rgba(255,255,255,.25); }
.urgent-check .svg-ico { color: var(--late); width: 18px; height: 18px; }
.urgent-check { margin: 4px 0 8px; }
