/* TeamTask — gabarit d'après joko-maquette.html : sidebar sombre, topbar, cartes.
   Pas de style en ligne possible (CSP default-src 'self') : tout passe par des classes. */
:root {
  --bg: #F6F7F9; --surface: #fff; --border: #E5E7EB; --line: #F1F2F4;
  --text: #111827; --muted: #6B7280;
  --primary: #4F46E5; --primary-50: #EEF2FF; --primary-700: #4338CA;
  --mail: #2563EB; --call: #EA580C; --wa: #16A34A;
  --ok: #16A34A; --warn: #92400E; --error: #DC2626;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --sidebar: 248px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font: 12px/1.3 ui-monospace, Consolas, monospace; background: #F1F5F9; padding: 1px 5px; border-radius: 4px; }
code.big { font-size: 16px; padding: 3px 8px; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; margin: 0 0 18px; }
h2 { font-size: 15px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 14px 0 6px; }
.muted { color: var(--muted); }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.sm { width: 14px; height: 14px; }
svg.sprite { position: absolute; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- Gabarit ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.app.collapsed { --sidebar: 68px; }
.app.collapsed .lbl, .app.collapsed .sec-title, .app.collapsed .nav .badge { display: none; }
.app.collapsed .nav a, .app.collapsed .nav button { justify-content: center; }

.sidebar { background: #0F172A; color: #CBD5E1; display: flex; flex-direction: column; padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; color: #fff; }
.brand:hover { text-decoration: none; }
.logo { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, #6366F1, #06B6D4); display: grid; place-items: center; color: #fff; font-weight: 800; flex: none; }
.brand b { color: #fff; font-size: 16px; display: block; line-height: 1.2; }
.brand small { color: #94A3B8; font-size: 11px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.sec-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #64748B; padding: 14px 10px 6px; }
.nav a, .nav button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; margin: 1px 0; position: relative; color: #CBD5E1; background: none; border: 0; font: inherit; text-align: left; cursor: pointer; transition: background .15s, color .15s; }
.nav a:hover, .nav button:hover { background: #1E293B; color: #fff; text-decoration: none; }
.nav a.active { background: #1E293B; color: #fff; }
.nav a.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #818CF8; }
.nav .badge { margin-left: auto; background: #EF4444; color: #fff; font-size: 11px; font-weight: 600; padding: 0 7px; }
.sidebar .foot { margin-top: auto; border-top: 1px solid #1E293B; padding-top: 10px; }
.sidebar .foot form { margin: 0; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 60px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; padding: 0 24px; position: sticky; top: 0; z-index: 5; }
.icon-btn { border: 0; background: none; padding: 7px; border-radius: 8px; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { background: var(--bg); color: var(--text); }
.crumbs { color: var(--muted); white-space: nowrap; }
.crumbs b { color: var(--text); font-weight: 600; }
.topbar .global-search { margin: 0 0 0 auto; display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; width: 340px; color: var(--muted); }
.topbar .global-search input { border: 0; background: none; outline: 0; flex: 1; font: inherit; color: var(--text); min-width: 0; padding: 0; }
.topbar .spacer { margin-left: auto; }
kbd { font: 11px ui-monospace, monospace; border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; background: #fff; }
.user { display: flex; align-items: center; gap: 10px; padding: 4px 8px; border-radius: 8px; color: var(--text); }
.user:hover { background: var(--bg); text-decoration: none; }
.user-name { display: block; font-weight: 600; line-height: 1.2; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.avatar.sm { width: 24px; height: 24px; font-size: 11px; }
.role { font-size: 11px; background: var(--primary-50); color: var(--primary-700); padding: 1px 8px; border-radius: 999px; font-weight: 600; }

.content { padding: 28px 32px; max-width: 1280px; width: 100%; margin: 0 auto; box-sizing: border-box; }
.content:has(.split) { max-width: 1480px; }

/* ---------- En-tête de page ---------- */
.page-head { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 16px; margin-bottom: 22px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 2px 0 0; color: var(--muted); }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; }

/* ---------- Cartes ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin: 0 0 20px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > table.dense { border: 0; border-radius: 0; box-shadow: none; }
.card-h { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-h h2 { margin: 0; }
.card-h a { margin-left: auto; font-weight: 500; font-size: 13px; }
.card.narrow { max-width: 420px; margin: 10vh auto 0; padding: 28px; }
.brand-title { font-size: 26px; margin: 0 0 16px; display: flex; align-items: center; gap: 10px; }
.brand-title .logo { width: 38px; height: 38px; font-size: 18px; }
.qr svg { display: block; margin: 8px auto; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { padding: 18px 20px; display: flex; gap: 14px; align-items: center; margin: 0; color: var(--text); }
a.kpi:hover { text-decoration: none; border-color: #C7D2FE; }
.kpi .ic { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.kpi .v, .kpi .l { display: block; }
.kpi .v { font-size: 24px; font-weight: 700; line-height: 1.1; }
.kpi .l { color: var(--muted); font-size: 13px; }
.c-pri { background: var(--primary-50); color: var(--primary); }
.c-mail { background: #DBEAFE; color: var(--mail); }
.c-call { background: #FFEDD5; color: var(--call); }
.c-wa { background: #DCFCE7; color: var(--wa); }

/* État vide */
.empty { text-align: center; padding: 56px 20px; }
.empty .big { width: 64px; height: 64px; border-radius: 16px; margin: 0 auto 16px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); }
.empty .big svg.i { width: 30px; height: 30px; }
.empty h3 { margin: 0 0 6px; font-size: 17px; }
.empty p { color: var(--muted); max-width: 420px; margin: 0 auto; }

/* ---------- Formulaires ---------- */
form label { display: block; margin: 8px 0; font-weight: 500; font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=date], input[type=datetime-local], input[type=file], select, textarea {
  font: inherit; font-weight: 400; color: var(--text); padding: 8px 11px; border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
form label input[type=text], form label input[type=email], form label input[type=password], form label select, form label textarea {
  display: block; width: 100%; margin-top: 5px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-50); border-color: var(--primary); }
form.inline { display: inline; }
form.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; align-items: end; }
form.grid fieldset { grid-column: 1 / -1; border: 1px solid var(--border); border-radius: 8px; }
form.grid .wide { grid-column: 1 / -1; }
form.grid fieldset.colors { display: flex; flex-wrap: wrap; gap: 6px 10px; }
form.grid fieldset.recurrence { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; align-items: end; padding: 12px 14px; }
form.grid fieldset.recurrence p { margin: 0; }
form label select[multiple] { min-height: 9em; }
form.roles { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: center; }
label.check { display: inline-flex; gap: 6px; align-items: center; margin: 0; white-space: nowrap; font-weight: 400; }
form.search { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 16px; }
form.search input[type=search], form.search input[type=text] { display: inline-block; width: auto; min-width: 280px; margin: 0; }
fieldset.bare { border: 0; padding: 0; margin: 0; display: contents; }
fieldset.bare[disabled] input, fieldset.bare[disabled] select, fieldset.bare[disabled] textarea { background: #F8FAFC; color: var(--text); }

/* ---------- Boutons ---------- */
button, .btn { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-weight: 500; cursor: pointer; border: 1px solid var(--border); background: #fff; color: var(--text); border-radius: 8px; padding: 7px 14px; transition: background .15s, border-color .15s; }
button:hover, .btn:hover { background: var(--bg); text-decoration: none; }
button.primary, .btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover, .btn.primary:hover { background: var(--primary-700); }
form > button.primary, form > div > button.primary { margin-top: 8px; }
button.small { padding: 3px 9px; font-size: 12px; border-radius: 6px; }
button.danger { color: var(--error); }
button.danger:hover { border-color: #FCA5A5; background: #FEF2F2; }
button.link { border: 0; background: none; padding: 0; color: var(--primary); }
button.link:hover { text-decoration: underline; background: none; }

/* ---------- Alertes ---------- */
.alert { padding: 10px 14px; border-radius: 8px; border: 1px solid; }
.alert.error { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }
.alert.info { background: var(--primary-50); border-color: #C7D2FE; color: var(--primary-700); }
.alert.success { background: #F0FDF4; border-color: #BBF7D0; color: #166534; }
.error-text { color: var(--error); font-size: 12px; }

/* ---------- Tableaux ---------- */
table.dense { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 16px; }
table.dense th, table.dense td { padding: 11px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.dense th { background: #FAFAFB; border-bottom-color: var(--border); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
table.dense tbody tr:last-child td { border-bottom: 0; }
table.dense tbody tr { transition: background .1s; }
table.dense tbody tr:hover { background: #FAFAFB; }
table.dense tr.inactive td { color: var(--muted); }
table.dense td a { color: var(--text); font-weight: 600; }
table.dense td a:hover { color: var(--primary); }
td.actions { white-space: nowrap; text-align: right; }
td.nowrap { white-space: nowrap; }
table.narrow-table { width: auto; min-width: 320px; }
table.narrow-table th { text-transform: none; letter-spacing: 0; font-size: 13px; }

/* ---------- Pastilles ---------- */
[hidden] { display: none !important; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #F1F5F9; color: #475569; }
.badge.ok { background: #DCFCE7; color: #166534; }
.badge.warn { background: #FEF3C7; color: var(--warn); }
.badge.status-open { background: #DBEAFE; color: #1E40AF; }
.badge.status-waiting_client { background: #FEF3C7; color: var(--warn); }
.badge.status-closed { background: #DCFCE7; color: #166534; }

/* ---------- Référentiel ---------- */
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 0 20px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 12px; }
.toolbar form.search { margin: 0; }
ul.plain { list-style: none; padding: 0; margin: 0 0 8px; }
ul.plain li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.swatch { width: 12px; height: 12px; vertical-align: -1px; }
.swatch.big { width: 18px; height: 18px; vertical-align: -2px; }
td.swatch-cell { width: 18px; padding-right: 0 !important; }
.point { display: inline-block; margin-right: 12px; white-space: nowrap; }
.dossier-tag { display: inline-flex; gap: 6px; align-items: center; margin-right: 10px; white-space: nowrap; }
a.dossier-tag { color: var(--text); }

/* ---------- Canaux, conversations ---------- */
pre.code { background: #0F172A; color: #E2E8F0; padding: 12px 14px; border-radius: 8px; overflow-x: auto; font: 12px/1.5 ui-monospace, Consolas, monospace; }
details summary { cursor: pointer; margin: 10px 0 4px; }
nav.tabs { display: flex; align-items: center; gap: 4px; margin: 0 0 16px; border-bottom: 1px solid var(--border); }
nav.tabs a { padding: 8px 12px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
nav.tabs a:hover { color: var(--text); text-decoration: none; }
nav.tabs a.active { border-bottom-color: var(--primary); color: var(--primary-700); font-weight: 600; }
nav.tabs a .badge { margin-left: 4px; }
nav.tabs a.active .badge { background: var(--primary-50); color: var(--primary-700); }
.tab-note { margin-left: auto; padding: 6px 12px; color: var(--muted); font-size: 12px; }
article.message, details.message { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--mail); border-radius: var(--radius); box-shadow: var(--shadow); margin: 12px 0; padding: 14px 18px; }
article.message.outbound, details.message.outbound { border-left-color: var(--primary); background: #FBFBFF; }
article.message header { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; margin-bottom: 8px; }
article.message .body, details.message .body { white-space: pre-wrap; word-wrap: break-word; }
p.attachments { margin: 10px 0 0; padding-top: 8px; border-top: 1px dashed var(--border); }

/* Fiche message / tâche : fil à gauche, colonne d'actions à droite */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px; align-items: start; }
.split .side { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 16px; }
.split .side .card { margin: 0; }
.split .side h2 { margin: 0 0 10px; font-size: 15px; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } .split .side { position: static; } }
.thread details.message { padding: 0; margin: 0 0 10px; }
.thread details.message[open] { padding-bottom: 6px; }
.thread details.message .body { font-size: 15px; line-height: 1.6; padding: 4px 0 8px; }
.thread details.message > summary { list-style: none; cursor: pointer; display: flex; gap: 8px; align-items: baseline; padding: 12px 18px; }
.thread details.message > summary::-webkit-details-marker { display: none; }
.thread details.message > summary .snippet { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread details.message[open] > summary .snippet { visibility: hidden; }
.thread details.message > :not(summary) { margin-left: 18px; margin-right: 18px; }
.thread details.message > :last-child { margin-bottom: 14px; }
.thread details.message .to { margin-top: 0; font-size: 13px; }
.thread details.message:not([open]) { box-shadow: none; }
.thread details.message:not([open]):hover { border-color: #CBD5E1; }
.thread details.message[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.thread details.message > summary .when { margin-left: auto; }
a.attachment { display: inline-block; margin: 2px 6px 2px 0; padding: 3px 10px; border: 1px solid var(--border); border-radius: 6px; background: #fff; font-size: 13px; }
form.stack { display: flex; flex-direction: column; gap: 10px; margin: 0 0 10px; }
form.stack .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
form.stack .pair > * { min-width: 0; }
form.stack label { margin: 0; }
form.stack select, form.stack input[type=text], form.stack input[type=date] { width: 100%; }
details.choice { border: 1px solid var(--border); border-radius: 8px; margin: 0 0 8px; background: #fff; }
details.choice > summary { cursor: pointer; padding: 10px 12px; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px; }
details.choice > summary::-webkit-details-marker { display: none; }
details.choice > summary::before { content: ""; width: 14px; height: 14px; border: 2px solid #CBD5E1; border-radius: 50%; flex: none; }
details.choice[open] { border-color: #A5B4FC; box-shadow: 0 0 0 3px var(--primary-50); }
details.choice[open] > summary::before { border-color: var(--primary); background: radial-gradient(var(--primary) 0 3px, transparent 4px); }
details.choice > :not(summary) { margin: 0 12px 12px; }
.small-note { font-size: 12px; }
details.change-client > summary { cursor: pointer; color: var(--primary-700); font-size: 13px; font-weight: 500; margin: 4px 0 8px; }
details.change-client[open] > summary { margin-bottom: 10px; }
.late { color: #B91C1C; font-weight: 600; }
.who-client { color: var(--warn); font-weight: 600; }
.who-us { color: var(--muted); }
.progress { font-size: 12px; color: var(--muted); }
table.tasks tbody tr[data-href] { cursor: pointer; }
table.tasks tbody tr:hover td { background: #FAFAFF; }
table.tasks a.subject { font-weight: 600; color: var(--text); }
button.secondary { background: transparent; color: var(--muted); }
button.secondary:hover { color: #B91C1C; border-color: #FECACA; background: #FEF2F2; }
form.close-task { text-align: center; }
form.close-task button { width: 100%; justify-content: center; }
fieldset.after-send { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin: 10px 0; display: flex; flex-direction: column; gap: 6px; }
fieldset.after-send legend { font-size: 12px; color: var(--muted); padding: 0 4px; }
fieldset.after-send input[type=date] { width: auto; display: inline-block; margin: 0 0 0 4px; padding: 3px 6px; }
.reply-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
section.task-description { white-space: pre-wrap; }
section.channel-link { display: flex; align-items: center; gap: 14px; }
section.channel-link > svg.i { width: 28px; height: 28px; color: var(--call); flex: none; }
section.channel-link > div { flex: 1; }
code.secret { display: inline-block; padding: 8px 12px; font-size: 14px; background: #FEF3C7; border-radius: 6px; user-select: all; word-break: break-all; }
ul.plain-list { list-style: none; margin: 0; padding: 0; }
ul.plain-list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
ul.plain-list li:last-child { border-bottom: 0; }
h1 > svg.i { width: 26px; height: 26px; vertical-align: -4px; color: var(--call); }
.card:target { box-shadow: 0 0 0 3px var(--primary-50); border-color: #A5B4FC; }

/* Inbox */
table.inbox td.client { white-space: nowrap; }
table.inbox th.sel, table.inbox td.sel { width: 28px; padding-right: 0; }
table.inbox tbody tr[data-href] { cursor: pointer; }
table.inbox tbody tr:hover td { background: #FAFAFF; }
table.inbox tbody tr.selected td { background: var(--primary-50); }
table.inbox tbody tr.kb-active td { background: #F5F7FF; }
table.inbox tbody tr.kb-active td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.kbd-help { font-size: 12px; margin-top: 10px; }
kbd { font: 11px ui-monospace, monospace; padding: 1px 5px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; background: #fff; }
table.inbox td.msg { max-width: 0; width: 55%; }
table.inbox a.subject { font-weight: 600; color: var(--text); }
table.inbox .preview { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
table.inbox .preview .you { color: var(--primary-700); }
table.inbox td.who { white-space: nowrap; }
.chan { display: inline-block; margin-top: 3px; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.chan-email { background: #DBEAFE; color: var(--mail); }
.chan-phone { background: #FFEDD5; color: var(--call); }
.chan-whatsapp { background: #DCFCE7; color: var(--wa); }
a.assoc { font-size: 12px; margin-left: 4px; }
table.inbox td.actions { white-space: nowrap; text-align: right; }
.row-actions { display: inline-flex; gap: 4px; visibility: hidden; }
table.inbox tr:hover .row-actions, table.inbox tr:focus-within .row-actions { visibility: visible; }
@media (hover: none) { .row-actions { visibility: visible; } }
a.btn.small { padding: 3px 9px; font-size: 12px; border-radius: 6px; }
table.inbox td.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.bulk-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; margin: -8px 0 8px; padding: 8px 12px;
  background: var(--primary-50); border: 1px solid #C7D2FE; border-radius: 8px; }
.bulk-bar[hidden] { display: none; }
.bulk-count { font-weight: 600; color: var(--primary-700); margin-right: 6px; }
button.chip { display: inline-flex; gap: 6px; align-items: center; padding: 3px 10px; border: 1px dashed #CBD5E1; border-radius: 999px; font-size: 12px; margin: 1px 2px; color: var(--muted); }
button.chip:hover { border-style: solid; border-color: var(--primary); background: var(--primary-50); color: var(--primary-700); }
.conversation-head { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; align-items: flex-start; }
.conversation-head p { margin: 4px 0; }
.conversation-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
form.match-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
form.match-form select { max-width: 280px; }
details.html-version { margin-top: 8px; }
details.html-version iframe { width: 100%; height: 420px; border: 1px solid var(--border); border-radius: 8px; background: #fff; resize: vertical; }

/* Tâches */
tr.news td { background: #FFFBEB; }
tr.news td:first-child { box-shadow: inset 3px 0 0 #F59E0B; }
.tab-filter { margin-left: auto; display: flex; gap: 6px; align-items: center; padding: 2px 0 6px; }
.task-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; }
.task-head p { margin: 4px 0; }
.task-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
form.inline-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
form.inline-form label { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
form.reply-form textarea { width: 100%; margin: 6px 0; font: inherit; }
.reply-options { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Écrans étroits : menu replié d'office. */
@media (max-width: 900px) {
  .app { --sidebar: 68px; }
  .app .lbl, .app .sec-title, .app .nav .badge, .crumbs { display: none; }
  .app .nav a, .app .nav button { justify-content: center; }
  .topbar .global-search { width: auto; flex: 1; }
  .content { padding: 20px 16px; }
}

/* Recherche à facettes (search_bar.html) */
.facet-search { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; flex-wrap: wrap; }
.facet-box { position: relative; flex: 1; min-width: 320px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 5px 10px; color: var(--muted); }
.facet-box:focus-within { border-color: #A5B4FC; box-shadow: 0 0 0 3px var(--primary-50); }
.facet-input { flex: 1; width: auto !important; min-width: 160px; border: 0 !important; outline: 0 !important; background: none !important; font: inherit; color: var(--text); padding: 3px 0 !important; margin: 0 !important; box-shadow: none !important; }
.facet { display: inline-flex; align-items: center; gap: 4px; background: var(--primary-50); color: var(--primary-700); border-radius: 6px; padding: 2px 4px 2px 8px; font-size: 13px; max-width: 100%; }
.facet b { font-weight: 600; }
.facet b::after { content: " :"; }
.facet-x { color: var(--primary-700); padding: 0 5px; border-radius: 4px; font-size: 15px; line-height: 1; }
.facet-x:hover { background: #E0E7FF; text-decoration: none; }
.facet-menu { position: absolute; left: -1px; right: -1px; top: calc(100% + 4px); z-index: 20; margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(16,24,40,.12); color: var(--text); }
.facet-menu li { padding: 6px 10px; border-radius: 6px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.facet-menu li i { color: var(--primary-700); font-style: normal; font-weight: 600; }
.facet-menu li.active { background: var(--primary-50); }
.facet-filters { position: relative; }
.facet-filters summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-weight: 500; }
.facet-filters summary::-webkit-details-marker { display: none; }
.facet-filters[open] summary { border-color: #A5B4FC; }
.facet-panel { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; width: 520px; max-width: 90vw; padding: 12px 14px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(16,24,40,.12); }
.facet-group h4 { margin: 0 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.facet-group a { display: flex; align-items: center; gap: 6px; padding: 3px 4px; border-radius: 5px; color: var(--text); }
.facet-group a:hover { background: var(--bg); text-decoration: none; }
.facet-group a svg.i { width: 14px; height: 14px; visibility: hidden; color: var(--primary); }
.facet-group a.on { color: var(--primary-700); font-weight: 600; }
.facet-group a.on svg.i { visibility: visible; }
.facet-help { grid-column: 1 / -1; margin: 4px 0 0; font-size: 12px; line-height: 1.6; }
.facet-clear { padding: 9px 4px; }
.facet-pill { display: inline-flex; align-items: center; box-sizing: border-box; height: 34px; margin: 0; line-height: 1; padding: 0 11px; border: 1px dashed #CBD5E1; border-radius: 999px;
  background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer; list-style: none; }
.facet-pill:hover, .facet-pill-menu[open] .facet-pill { border-style: solid; border-color: var(--primary); color: var(--primary-700); background: var(--primary-50); }
.facet-pill::-webkit-details-marker { display: none; }
.facet-pill-menu { position: relative; }
.facet-pill-menu .facet-panel { left: 0; right: auto; width: 220px; grid-template-columns: 1fr; gap: 0; }
.facet-pill-menu .facet-panel a { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 5px; color: var(--text); }
.facet-pill-menu .facet-panel a:hover { background: var(--bg); text-decoration: none; }
.facet-pill-menu .facet-panel a svg.i { width: 14px; height: 14px; visibility: hidden; color: var(--primary); }
.facet-pill-menu .facet-panel a.on { color: var(--primary-700); font-weight: 600; }
.facet-pill-menu .facet-panel a.on svg.i { visibility: visible; }
.facet-input::-webkit-search-cancel-button { display: none; }
.facet-error { margin: -8px 0 12px; }

/* Canaux */
h2.section-title { margin: 28px 0 12px; font-size: 16px; }
.imap-form h2 { margin-top: 18px; }
.imap-form .grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 16px; align-items: end; }
@media (max-width: 1000px) { .imap-form .grid { grid-template-columns: 1fr; } }
.imap-form h2:first-of-type { margin-top: 0; }
label.check { display: flex; align-items: center; gap: 8px; }
label.check input { width: auto; }
details.advanced { margin: 8px 0 16px; }
details.advanced > summary { cursor: pointer; color: var(--muted); margin-bottom: 12px; }

/* Check-list des tâches */
.checklist { list-style: none; margin: 0 0 12px; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist .check { width: 22px; height: 22px; padding: 0; border-radius: 6px; border: 1.5px solid #CBD5E1; background: #fff;
  display: inline-grid; place-items: center; flex: none; color: #fff; }
.checklist li.done .check { background: var(--ok); border-color: var(--ok); }
.checklist .check svg.i { width: 14px; height: 14px; stroke-width: 3; }
.checklist li.done .label { color: var(--muted); text-decoration: line-through; }
.checklist .small { font-size: 12px; margin-left: auto; }
.task-description { white-space: pre-wrap; color: var(--muted); }

/* Fiche d'appel : « Noter l'appel » */
.radio-row { display: flex; gap: 20px; }
