/* Tadafuq — feuille de style principale.
   Les noms de classes existants sont conservés : toutes les pages connectées partagent ces styles. */

/* ---------- Jetons ---------- */
:root {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-ink: #3730a3;
  --accent-soft: #eef2ff;
  --ok: #047857;
  --ok-soft: #ecfdf5;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  --focus: 0 0 0 3px rgba(79, 70, 229, 0.22);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-ink); text-underline-offset: 3px; }
a:hover { color: var(--text); }
h1, h2, h3 { color: var(--text); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }

/* ---------- Coquille : barre latérale (ordinateur) ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
  color: var(--text);
  text-decoration: none;
}
.brand-mark {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }

.nav { display: grid; gap: 2px; }

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--text-2);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.nav-link:hover { background: #f1f5f9; color: var(--text); }
.nav-link.is-active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav-link-small { font-size: 13px; color: var(--muted); }
.nav-logout { color: var(--muted); }

.sidebar-foot {
  margin-top: auto;
  padding-top: 12px;
  display: grid;
  gap: 2px;
  border-top: 1px solid var(--line);
}
.sidebar-foot form { margin: 0; }
.who { padding: 6px 12px 8px; font-size: 13px; color: var(--muted); }
.who strong { display: block; color: var(--text); font-size: 14px; }

.app-main { min-width: 0; display: flex; flex-direction: column; }

/* ---------- Bandeau mobile ---------- */
.mobilebar { display: none; }

.m-menu { position: relative; }
.m-menu summary {
  list-style: none;
  cursor: pointer;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  font-weight: 600;
  font-size: 14px;
}
.m-menu summary::-webkit-details-marker { display: none; }
.m-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(300px, calc(100vw - 32px));
  z-index: 20;
  display: grid;
  gap: 2px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}
.m-menu-list form { margin: 0; }

/* ---------- Conteneur de page ---------- */
.shell {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 32px 80px;
}

/* ---------- Bandeau historique (pages non encore migrées) ---------- */
.topbar {
  min-height: 62px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
}
.topbar strong { font-size: 18px; }
.topbar .muted { margin-left: 10px; }
.topbar a { text-decoration: none; }

.user { font-size: 13px; color: var(--muted); }
.user form { display: inline; }
.link-button {
  margin: 0; padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.link-button:hover { color: var(--text); }

/* ---------- Entête de page ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 480px);
  gap: 24px;
  align-items: end;
  margin-bottom: 26px;
}
.hero h1 { font-size: 30px; line-height: 1.15; margin: 4px 0 0; letter-spacing: -0.02em; text-wrap: balance; }
.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Formulaires ---------- */
input, select, textarea, button { font: inherit; }
input, select, textarea {
  min-height: 40px;
  min-width: 0;
  max-width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}
input::placeholder, textarea::placeholder { color: #94a3b8; }
input:hover, select:hover, textarea:hover { border-color: #94a3b8; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }

button {
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.ghost {
  padding: 7px 12px;
  min-height: 34px;
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--line-strong);
}
.ghost:hover { background: var(--surface-2); border-color: #94a3b8; color: var(--text); }

.check {
  width: 34px; height: 34px;
  padding: 0;
  border-radius: 50%;
  background: var(--ok-soft);
  color: var(--ok);
  border: 1px solid #a7f3d0;
  font-size: 15px;
}
.check:hover { background: #d1fae5; border-color: #6ee7b7; color: var(--ok); }

.capture, .inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; min-width: 0; }
.capture input { flex: 1 1 200px; min-width: 0; }
.capture button { flex: 0 0 auto; }

.inline-form { margin-bottom: 14px; }
.inline-form input, .inline-form select { flex: 1 1 140px; min-width: 0; }
.inline-form input[name=title] { flex: 1 1 220px; }
.inline-form button { flex: 0 0 auto; }
.client-form input { flex: 1 1 150px; }

.task-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}
.task-form > * { min-width: 0; }
.task-form label { display: grid; gap: 6px; min-width: 0; font-size: 13px; font-weight: 600; color: var(--text-2); }
.task-form textarea { width: 100%; min-height: 84px; resize: vertical; }
.task-form button { justify-self: start; }

.pw-form { display: grid; gap: 14px; max-width: 460px; }
.pw-form label { display: grid; gap: 6px; font-weight: 600; font-size: 13px; color: var(--text-2); }

.span-2 { grid-column: span 2; }

/* ---------- Cartes (panneaux) ---------- */
.panel {
  min-width: 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel.full { grid-column: 1 / -1; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-bottom: 14px;
}
.panel-head h2 { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; margin: 0; }
.panel-head a.muted { font-size: 13px; margin-left: auto; }
.panel-head a.muted + a.muted { margin-left: 0; }

.count {
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.muted { color: var(--muted); }

/* ---------- Indicateurs ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stats article {
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stats strong { display: block; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.stats span { color: var(--muted); font-size: 13px; }

/* ---------- Mise en page en deux colonnes ---------- */
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.list { display: grid; gap: 0; }

/* ---------- Lignes de liste ---------- */
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.row:first-child { border-top: 0; padding-top: 2px; }
.row > div { flex: 1; min-width: 0; }
.row strong, .row small { display: block; overflow-wrap: anywhere; }
.row strong { font-weight: 600; }
.row small, .row .task-meta { color: var(--muted); font-size: 13px; }
.row form { margin: 0; min-width: 0; max-width: 100%; }
.row button { max-width: 100%; }
.row .actions { margin-left: auto; }

.priority-row { padding: 14px 0; }
.priority-add { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }

.prio-num {
  width: 30px; height: 30px;
  flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

/* Mes 3 priorités : mise en valeur */
.priority-panel {
  border-color: #c7d2fe;
  background: linear-gradient(180deg, #f5f7ff 0, #ffffff 140px);
  box-shadow: 0 0 0 1px #e0e7ff inset, var(--shadow);
}
.priority-panel .priority-row:first-of-type { padding-top: 0; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.badge-today { background: var(--ok-soft); color: var(--ok); }
.badge-late { background: var(--danger-soft); color: var(--danger); }

/* ---------- Messages ---------- */
.empty { margin: 6px 0 10px; color: var(--muted); font-style: italic; font-size: 14px; }
.alert { margin-bottom: 16px; padding: 12px 14px; border: 1px solid transparent; border-radius: var(--radius-sm); }
.alert.success { background: var(--ok-soft); color: var(--ok); border-color: #a7f3d0; }
.alert.error { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }

/* ---------- Clients ---------- */
.client-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.client-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
.client-card strong, .client-card span, .client-card small { display: block; overflow-wrap: anywhere; }
.client-card span, .client-card small { color: var(--muted); font-size: 13px; }

/* Barre de commandes, formulaire replié et liste triable des clients (lot clients) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.client-toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.client-search { display: flex; gap: 8px; flex: 1 1 340px; min-width: 0; flex-wrap: wrap; margin: 0; }
.client-search input[type=search] { flex: 1 1 220px; min-width: 0; }
.client-search button, .client-toolbar-actions > .ghost, .client-toolbar-actions > .button-link { flex: 0 0 auto; }
.button-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}
.button-link:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.client-form-panel > summary { list-style: none; cursor: pointer; }
.client-form-panel > summary::-webkit-details-marker { display: none; }
.client-form-summary { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
.client-form-summary::after { content: ' ▾'; color: var(--muted); font-weight: 400; }
.client-form-panel[open] > .client-form-summary { margin-bottom: 14px; }
.client-form-panel[open] > .client-form-summary::after { content: ' ▴'; }
.client-form-cancel { margin: -6px 0 12px; font-size: 13px; }
.client-form-required { margin: 0 0 12px; }
.client-table-wrap { overflow-x: auto; }
.client-table th a { color: inherit; text-decoration: none; white-space: nowrap; }
.client-table th a:hover { color: var(--text); text-decoration: underline; }
.client-table th[aria-sort] a { color: var(--text-2); }
.client-table td span { display: block; }
.client-table td small { display: block; margin-top: 2px; }
.client-table-actions { white-space: nowrap; }
.client-table-actions a + a { margin-left: 6px; }
.client-pager { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 14px; }
.ghost.is-disabled { opacity: 0.45; pointer-events: none; }
@media (min-width: 641px) {
  /* Bureau : colonnes resserrées, le nom ne se découpe pas lettre à lettre. */
  .client-table td { padding: 10px 8px; }
  .client-table td[data-label="Nom"] { min-width: 150px; }
  .client-table td[data-label="Contact"] small { overflow-wrap: anywhere; }
}
@media (max-width: 640px) {
  .client-search { flex-basis: 100%; }
  .client-search input[type=search], .client-search button { flex: 1 1 100%; width: 100%; }
  .client-toolbar-actions > .button-link, .client-toolbar-actions > .ghost { flex: 1 1 100%; justify-content: center; }
  .client-table thead { display: none; }
  .client-table, .client-table tbody, .client-table tr, .client-table td { display: block; width: 100%; }
  .client-table tr { padding: 12px 0; border-top: 1px solid var(--line); }
  .client-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
    border: 0;
    text-align: right;
  }
  .client-table td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-align: left;
    text-transform: uppercase;
  }
  .client-table td[data-label="Nom"] { display: block; text-align: left; font-size: 16px; padding-bottom: 6px; }
  .client-table td[data-label="Nom"]::before { display: none; }
  .client-table td[data-label="Prochaine action"] { text-align: left; }
  .client-table td[data-label="Prochaine action"]::before { display: block; margin-bottom: 4px; }
  .client-table td[data-label="Prochaine action"] { flex-direction: column; align-items: flex-start; }
  .client-table-actions { justify-content: flex-start; padding-top: 8px; }
  .client-table-actions::before { display: none; }
  .client-table-actions a { flex: 1 1 0; text-align: center; }
  .client-table-actions a + a { margin-left: 0; }
  .client-pager { justify-content: center; text-align: center; }
  .client-pager .ghost { flex: 1 1 120px; text-align: center; }
}

/* ---------- Focus ---------- */
.focus-active { border-color: #c7d2fe; }
.focus-info { display: grid; gap: 4px; margin-bottom: 12px; }
.focus-timer {
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.focus-row { padding: 10px 0; border-top: 1px solid var(--line); }

/* ---------- Onglets de vue, notes, lignes de document ---------- */
.views-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.views-nav a {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}
.views-nav a:hover { border-color: #94a3b8; color: var(--text); }
.views-nav a.active { background: var(--text); border-color: var(--text); color: #fff; }

.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.notes-block {
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 14px;
}
.interaction-row, .waiting-row, .inbox-row, .quote-line, .invoice-line, .suggestion { padding: 12px 0; border-top: 1px solid var(--line); }
.suggestion-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.inbox-convert { margin-top: 10px; }
.inbox-convert > summary { list-style: none; display: inline-flex; cursor: pointer; }
.inbox-convert > summary::-webkit-details-marker { display: none; }
.inbox-convert > .inline-form { margin: 10px 0 0; }
.inbox-convert > .inline-form input[name=title] { flex: 1 1 100%; }
.inbox-convert > .inline-form select { flex: 1 1 160px; }

/* Kanban des opportunités : une colonne par étape, défilement interne sur petit écran. */
.kanban { display: grid; grid-template-columns: repeat(6, minmax(160px, 1fr)); gap: 10px; align-items: start; overflow-x: auto; padding-bottom: 4px; }
.kanban-col { min-width: 0; display: grid; gap: 8px; align-content: start; padding: 10px; background: var(--surface-2); border: 1px solid var(--line); border-top: 3px solid var(--line-strong); border-radius: var(--radius-sm); }
.kanban-col.kanban-won { border-top-color: var(--ok); }
.kanban-col.kanban-lost { border-top-color: var(--danger); }
.kanban-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; }
.kanban-col .empty { margin: 0; font-size: 13px; }
.kanban-card { min-width: 0; display: grid; gap: 6px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.kanban-card small { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.kanban-title { font-weight: 600; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.kanban-title:hover { text-decoration: underline; }
.kanban-amount { color: var(--text-2) !important; font-weight: 600; }
.kanban-move { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin: 2px 0 0; }
.kanban-move select { min-width: 0; padding: 6px 8px; font-size: 13px; }
.kanban-move button { width: 100%; padding: 6px 10px; font-size: 13px; }
@media (max-width: 640px) {
  .kanban { grid-template-columns: repeat(6, minmax(190px, 1fr)); }
}

/* ---------- Tableaux ---------- */
table { width: 100%; max-width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
}
td { padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }

/* ---------- Connexion / installation ---------- */
.auth-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 22px;
  background: linear-gradient(180deg, #eef2ff 0, var(--bg) 60%);
}
.auth-card {
  width: min(420px, 100%);
  padding: 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}
.auth-card h1 { margin: 0 0 4px; font-size: 24px; letter-spacing: -0.02em; }
.auth-card p { color: var(--muted); margin: 0; }
.auth-card form { display: grid; gap: 14px; margin-top: 20px; }
.auth-card label { display: grid; gap: 6px; font-weight: 600; font-size: 13px; color: var(--text-2); }
.auth-card button { width: 100%; }

/* ---------- Tablette et mobile ---------- */
@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .mobilebar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
  }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .shell { padding: 24px 18px 64px; }
}

@media (max-width: 640px) {
  .hero h1 { font-size: 24px; }
  .capture { flex-direction: column; align-items: stretch; }
  .capture input { flex: none; width: 100%; }
  .capture button { width: 100%; }
  .stats strong { font-size: 24px; }
  .stats { gap: 10px; }
  .panel { padding: 16px; }
  .inline-form input, .inline-form select { flex: 1 1 100%; }
  .inline-form button { width: 100%; }
  .row { flex-wrap: wrap; }
  .row .actions { margin-left: 0; }
  .task-form { grid-template-columns: minmax(0, 1fr); }
  .task-form button { width: 100%; }
  .client-grid { grid-template-columns: minmax(0, 1fr); }
  .shell { padding: 20px 14px 56px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Colonnes du cockpit */
.col { display: grid; gap: 20px; align-content: start; min-width: 0; }

/* Notes client : sauvegarde automatique (lot R2) */
.notes-textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  line-height: 1.5;
}
.notes-textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.notes-status { font-size: 13px; color: var(--muted); }
.notes-status.is-saving { color: var(--accent); }
.notes-status.is-saved { color: var(--ok); }
.notes-status.is-error { color: var(--danger); }
.notes-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.notes-conflict {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
}
.notes-conflict pre {
  margin: 8px 0;
  padding: 10px;
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  white-space: pre-wrap;
}
.ghost.danger { color: var(--danger); border-color: #fecaca; }
.ghost.danger:hover { background: var(--danger-soft); }

/* Kanban des taches (lot R3) */
.kanban--tasks { grid-template-columns: repeat(4, minmax(220px, 1fr)); }
.task-col-todo { border-top-color: var(--line-strong); }
.task-col-doing { border-top-color: var(--accent); }
.task-col-waiting { border-top-color: #b45309; }
.task-col-done { border-top-color: var(--ok); }
.task-column-body { display: grid; gap: 8px; align-content: start; min-height: 60px; }
.task-card { cursor: grab; }
.task-card.is-dragging { opacity: 0.45; }
.task-card.is-saving { opacity: 0.6; }
.kanban-col.drop-target { outline: 2px dashed var(--accent); outline-offset: -4px; }
.task-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.task-priority {
  flex: 0 0 auto;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}
.task-priority.p1 { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }
.task-priority.p2 { background: var(--accent-soft); color: var(--accent-ink); border-color: #c7d2fe; }
.task-priority.p3 { background: var(--surface-2); color: var(--muted); }
.task-due.is-late { color: var(--danger); }
.task-next { color: var(--text-2) !important; }
.task-move { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px; align-items: center; margin-top: 2px; }
.task-move button { min-width: 32px; padding: 4px 8px; }
.task-move select { min-width: 0; padding: 5px 6px; font-size: 12px; }
.task-board-status { margin-left: auto; font-size: 13px; color: var(--muted); }
.task-board-status.is-saving { color: var(--accent); }
.task-board-status.is-saved { color: var(--ok); }
.task-board-status.is-error { color: var(--danger); }
.task-board-notice { margin: 0 0 8px; font-size: 13px; }

@media (max-width: 640px) {
  .kanban--tasks { grid-template-columns: repeat(4, minmax(210px, 1fr)); }
}

/* ---------- Pilotage, entreprises, notes, modèles (prompts 2 à 30) ---------- */
.section-title { margin: 20px 0 8px; font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }

.check-line { display: flex; align-items: center; gap: 8px; margin: 12px 0; font-size: 14px; color: var(--text-2); }
.check-line input { min-height: 0; width: 18px; height: 18px; }

.target-field { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.target-field input { width: 130px; min-height: 38px; }

.funnel { display: grid; gap: 12px; }
.funnel-step { display: grid; gap: 4px; }
.funnel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.funnel-bar { height: 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.funnel-bar span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }

.report-chart { display: block; width: 100%; max-width: 720px; height: auto; margin-top: 8px; }

.digest-preview, .template-preview {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.template-card {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.template-card:first-of-type { border-top: 0; padding-top: 0; }
.template-card summary { cursor: pointer; display: grid; gap: 3px; }
.template-card summary strong { font-weight: 600; }
.template-card summary small { color: var(--muted); font-size: 13px; }
.template-card[open] summary { margin-bottom: 10px; }
.template-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.template-actions .ghost { text-decoration: none; display: inline-flex; align-items: center; }

.note-content { margin: 6px 0 0; color: var(--text-2); font-size: 14px; }

@media (max-width: 640px) {
  .target-field { flex: 1 1 100%; justify-content: space-between; }
  .target-field input { width: 55%; }
}
