/* ═══════════════════════════════════════════════════════════════
   Médiablue Dashboard — main.css
   Thème : cozy-pro (fond crème, topbar sombre, badges vibrants)
   ═══════════════════════════════════════════════════════════════ */

/* ── Reset & base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Palette principale */
  --blue:        #3b5bdb;
  --blue-light:  #eef2ff;
  --blue-dark:   #2f4ac0;
  --blue-mid:    #6b83e0;

  /* Fond & surfaces */
  --bg:          #f5f2ec;        /* crème chaud */
  --surface:     #fefcf9;        /* blanc chaud */
  --surface-2:   #f0ece5;        /* crème plus soutenu */
  --border:      #e3ddd5;
  --border-light:#ede9e2;

  /* Texte */
  --text:        #1c1917;
  --text-muted:  #78716c;
  --text-faint:  #a8a29e;

  /* Topbar sombre */
  --topbar-bg:   #1e1a2e;
  --topbar-text: #e8e4f0;
  --topbar-muted:#9d96b8;
  --topbar-hover:#2e2844;

  /* Statuts — palette couleurs vives */
  --nouveau-bg:   #e0f7fa; --nouveau-fg:   #006064;   /* cyan       */
  --encours-bg:   #e3f2fd; --encours-fg:   #1565c0;   /* bleu moyen */
  --bloque-bg:    #ffebee; --bloque-fg:    #c62828;   /* rouge      */
  --termine-bg:   #e8f5e9; --termine-fg:   #2e7d32;   /* vert       */

  /* Responsable */
  --client-bg:    #fff3e0; --client-fg:    #bf360c;   /* orange     */
  --mediablue-bg: #f3e5f5; --mediablue-fg: #6a1b9a;   /* violet     */

  /* Misc */
  --radius:      10px;
  --radius-sm:   6px;
  --radius-lg:   14px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow:      0 4px 12px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.05);
  --shadow-lg:   0 16px 40px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);
  --topbar-h:    54px;
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Topbar (sombre) ────────────────────────────────────────────── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--topbar-h);
  background: var(--topbar-bg);
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px;
  gap: 12px;
}

.topbar-brand { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.topbar-logo {
  font-weight: 800; font-size: 15px; letter-spacing: -.2px;
  color: #fff; text-decoration: none;
  background: linear-gradient(135deg, #7b8ef5, #a78bfa);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.topbar-logo:hover { text-decoration: none; opacity: .85; }
.topbar-sep    { color: rgba(255,255,255,.2); }
.topbar-crumb  { color: var(--topbar-muted); font-weight: 500; transition: color .15s; }
.topbar-crumb:hover { color: var(--topbar-text); text-decoration: none; }
.topbar-section { color: var(--topbar-text); font-weight: 500; }

.topbar-nav { display: flex; align-items: center; gap: 4px; }

.topbar-btn, .topbar-logout {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  color: var(--topbar-muted); transition: background .15s, color .15s;
}
.topbar-btn svg, .topbar-logout svg { width: 18px; height: 18px; }
.topbar-btn:hover, .topbar-logout:hover {
  background: var(--topbar-hover); color: var(--topbar-text); text-decoration: none;
}

.main-content { padding-top: var(--topbar-h); }

/* ── Auth pages ─────────────────────────────────────────────────── */
body.auth-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--bg);
}
body.auth-page .main-content { padding-top: 0; width: 100%; }

.auth-card {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 44px; width: 100%; max-width: 400px; margin: auto;
}
.auth-logo {
  width: 52px; height: 52px; border-radius: var(--radius);
  background: var(--topbar-bg);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; margin-bottom: 22px;
  letter-spacing: -.5px;
}
.auth-title    { font-size: 21px; font-weight: 700; margin-bottom: 6px; }
.auth-subtitle { color: var(--text-muted); margin-bottom: 28px; }
.auth-error {
  background: var(--bloque-bg); border: 1px solid #fca5a5;
  color: var(--bloque-fg); border-radius: var(--radius-sm);
  padding: 10px 14px; margin-bottom: 16px; font-size: 13px;
}
.auth-footer { margin-top: 22px; text-align: center; font-size: 13px; color: var(--text-muted); }

/* ── Form fields ─────────────────────────────────────────────────── */
.field       { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.field input {
  width: 100%; padding: 10px 13px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; outline: none;
  background: var(--bg); transition: border .15s, box-shadow .15s;
}
.field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,91,219,.12);
  background: var(--surface);
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius-sm); font-size: 14px;
  font-weight: 600; cursor: pointer; border: none; transition: all .15s;
}
.btn-primary  { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); color: #fff; text-decoration: none; box-shadow: 0 4px 12px rgba(59,91,219,.3); }
.btn-secondary {
  background: var(--surface); color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-2); text-decoration: none; }
.btn-full     { width: 100%; justify-content: center; }
.btn-icon {
  background: none; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 4px 10px; font-size: 18px; cursor: pointer; color: var(--text-muted);
  line-height: 1; transition: background .12s;
}
.btn-icon:hover { background: var(--surface-2); }

/* ── Page header ─────────────────────────────────────────────────── */
.page-header { padding: 30px 26px 18px; }
.page-header h1 { font-size: 23px; font-weight: 700; letter-spacing: -.3px; }
.page-header p  { color: var(--text-muted); margin-top: 3px; }

/* ── Admin bar ──────────────────────────────────────────────────── */
.admin-bar { padding: 0 26px 18px; }

/* ── Home: client grid ──────────────────────────────────────────── */
.client-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px; padding: 0 26px 36px;
}
.client-card {
  background: var(--surface); border: 1.5px solid var(--border-light);
  border-radius: var(--radius); padding: 20px 22px;
  display: flex; align-items: center; gap: 16px;
  transition: box-shadow .18s, border-color .18s, transform .15s;
}
.client-card:hover {
  box-shadow: var(--shadow); border-color: var(--blue-mid);
  text-decoration: none; transform: translateY(-1px);
}
.client-card-initial {
  width: 46px; height: 46px; border-radius: var(--radius); flex-shrink: 0;
  background: linear-gradient(135deg, var(--blue), #6b83e0);
  color: #fff; font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.client-card-name { font-weight: 700; font-size: 15px; color: var(--text); }
.client-card-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Project list cards ─────────────────────────────────────────── */
.project-list-cards { padding: 0 26px 36px; display: flex; flex-direction: column; gap: 12px; }
.project-card {
  background: var(--surface); border: 1.5px solid var(--border-light);
  border-radius: var(--radius); padding: 18px 22px;
  border-left: 4px solid var(--border);
  display: block; transition: box-shadow .15s;
}
.project-card:hover { box-shadow: var(--shadow); text-decoration: none; }
.project-card.status-actif   { border-left-color: var(--blue); }
.project-card.status-termine  { border-left-color: #059669; }
.project-card-title { font-weight: 700; font-size: 15px; color: var(--text); }
.project-card-meta  { font-size: 12px; color: var(--text-muted); margin-top: 4px; display: flex; gap: 12px; }

/* ── Project toolbar ─────────────────────────────────────────────── */
.project-page .main-content { display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h)); }

.project-toolbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 22px; display: flex; align-items: center; gap: 20px;
  flex-shrink: 0; flex-wrap: wrap; min-height: 52px;
}

.view-tabs { display: flex; gap: 3px; }
.view-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 13px; border: none; background: none; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text-muted);
  transition: background .12s, color .12s;
}
.view-tab svg { width: 15px; height: 15px; }
.view-tab:hover  { background: var(--surface-2); color: var(--text); }
.view-tab.active { background: var(--blue-light); color: var(--blue); font-weight: 600; }

.toolbar-filters { display: flex; align-items: center; gap: 12px; margin-left: auto; flex-wrap: wrap; }
.filter-group    { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.filter-group label { color: var(--text-muted); white-space: nowrap; font-weight: 500; }
.filter-group select {
  padding: 5px 8px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; background: var(--surface); cursor: pointer; color: var(--text);
}
.plan-range-label { font-size: 13px; font-weight: 600; white-space: nowrap; min-width: 120px; text-align: center; }

/* ── View containers ─────────────────────────────────────────────── */
.view-container { display: none; flex: 1; overflow: auto; }
.view-container.active { display: block; }

/* ══════════════════════════════════════════════════════════════════
   LIST VIEW
   ══════════════════════════════════════════════════════════════════ */
.list-view { padding: 22px 26px; }

.list-group-header {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-faint);
  padding: 22px 0 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
.list-group-header:first-child { padding-top: 0; }

.task-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer;
  transition: background .12s; border-bottom: 1px solid var(--border-light);
}
.task-row:hover { background: var(--blue-light); }
.task-row:last-child { border-bottom: none; }

.task-status-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; margin-top: 6px;
}
.dot-nouveau   { background: #00bcd4; }
.dot-en_cours  { background: #1e88e5; }
.dot-bloque    { background: #e53935; }
.dot-termine   { background: #43a047; }

.task-row-main { flex: 1; min-width: 0; }
.task-row-title { font-size: 14px; font-weight: 500; color: var(--text); }
.task-row-title.is-done { text-decoration: line-through; color: var(--text-muted); }
.task-row-sub { font-size: 12px; color: var(--text-muted); margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; }

.task-row-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.task-date { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.task-date.overdue { color: var(--bloque-fg); font-weight: 600; }
.task-date.soon    { color: #b45309; font-weight: 600; }

/* ── Badges / étiquettes ─────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; padding: 3px 9px;
  border-radius: 20px; font-size: 11px; font-weight: 700;
  white-space: nowrap; letter-spacing: .01em;
}
.badge-nouveau   { background: var(--nouveau-bg);   color: var(--nouveau-fg); }
.badge-en_cours  { background: var(--encours-bg);   color: var(--encours-fg); }
.badge-bloque    { background: var(--bloque-bg);     color: var(--bloque-fg); }
.badge-termine   { background: var(--termine-bg);   color: var(--termine-fg); }
.badge-client    { background: var(--client-bg);    color: var(--client-fg); }
.badge-mediablue { background: var(--mediablue-bg); color: var(--mediablue-fg); }

.empty-section { padding: 10px 12px; color: var(--text-muted); font-size: 13px; font-style: italic; }

/* ══════════════════════════════════════════════════════════════════
   KANBAN VIEW
   ══════════════════════════════════════════════════════════════════ */
.kanban-view {
  display: flex; gap: 16px; padding: 22px 26px;
  height: 100%; overflow-x: auto; align-items: flex-start;
}

.kanban-col {
  flex: 0 0 282px; background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
  min-height: 200px; max-height: calc(100vh - 170px);
}

.kanban-col-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 2px 4px 10px; border-bottom: 2px solid transparent; margin-bottom: 2px;
}
.kanban-col.col-nouveau  .kanban-col-header { border-color: #00bcd4; }
.kanban-col.col-en_cours .kanban-col-header { border-color: #1e88e5; }
.kanban-col.col-bloque   .kanban-col-header { border-color: #e53935; }
.kanban-col.col-termine  .kanban-col-header { border-color: #43a047; }

.kanban-col-title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.kanban-col.col-nouveau  .kanban-col-title { color: var(--nouveau-fg); }
.kanban-col.col-en_cours .kanban-col-title { color: var(--encours-fg); }
.kanban-col.col-bloque   .kanban-col-title { color: var(--bloque-fg); }
.kanban-col.col-termine  .kanban-col-title { color: var(--termine-fg); }

.kanban-col-count {
  font-size: 11px; font-weight: 700; padding: 2px 8px;
  border-radius: 20px;
}
.col-nouveau  .kanban-col-count { background: var(--nouveau-bg);  color: var(--nouveau-fg); }
.col-en_cours .kanban-col-count { background: var(--encours-bg);  color: var(--encours-fg); }
.col-bloque   .kanban-col-count { background: var(--bloque-bg);   color: var(--bloque-fg); }
.col-termine  .kanban-col-count { background: var(--termine-bg);  color: var(--termine-fg); }

.kanban-cards { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; }

.kanban-card {
  background: var(--surface); border: 1.5px solid var(--border-light);
  border-radius: var(--radius); padding: 13px 15px;
  cursor: pointer; transition: box-shadow .15s, border-color .15s, transform .12s;
}
.kanban-card:hover {
  box-shadow: var(--shadow); border-color: var(--blue-mid);
  transform: translateY(-1px);
}

.kanban-card-title { font-size: 13px; font-weight: 500; color: var(--text); line-height: 1.45; }
.kanban-card-title.is-done { text-decoration: line-through; color: var(--text-muted); }
.kanban-card-meta  { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kanban-card-section { font-size: 11px; color: var(--text-faint); }
.kanban-card-date    { font-size: 11px; color: var(--text-muted); margin-left: auto; }
.kanban-card-date.overdue { color: var(--bloque-fg); font-weight: 600; }
.kanban-card-date.soon    { color: #b45309; font-weight: 600; }

.kanban-empty { color: var(--text-muted); font-size: 13px; font-style: italic; padding: 8px 4px; }

/* ══════════════════════════════════════════════════════════════════
   CALENDAR VIEW
   ══════════════════════════════════════════════════════════════════ */
.cal-view { padding: 22px 26px; }
.cal-nav { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.cal-nav-title { font-size: 17px; font-weight: 700; flex: 1; letter-spacing: -.2px; }
.cal-grid { display: flex; flex-direction: column; gap: 6px; }

.cal-day {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 10px 0; border-bottom: 1px solid var(--border-light);
}
.cal-day:last-child { border-bottom: none; }

.cal-day-label {
  width: 72px; flex-shrink: 0; text-align: right;
  padding-right: 14px; padding-top: 2px;
}
.cal-day-date    { font-size: 20px; font-weight: 700; line-height: 1; color: var(--text); }
.cal-day-weekday { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.cal-day-label.today .cal-day-date {
  background: var(--blue); color: #fff; width: 32px; height: 32px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  margin-left: auto; font-size: 15px;
}
.cal-day-tasks  { flex: 1; display: flex; flex-direction: column; gap: 6px; }

.cal-task {
  background: var(--surface); border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm); padding: 8px 13px;
  cursor: pointer; border-left: 3px solid var(--blue);
  transition: box-shadow .12s;
}
.cal-task.kanban-termine  { border-left-color: #43a047; opacity: .75; }
.cal-task.kanban-bloque   { border-left-color: #e53935; }
.cal-task.kanban-en_cours { border-left-color: #1e88e5; }
.cal-task.kanban-nouveau  { border-left-color: #00bcd4; }
.cal-task:hover { box-shadow: var(--shadow-sm); }
.cal-task-title { font-size: 13px; font-weight: 500; }
.cal-task-meta  { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

.cal-no-tasks { color: var(--text-faint); font-size: 13px; font-style: italic; padding: 4px 0; }
.cal-empty-month { color: var(--text-muted); font-style: italic; padding: 48px; text-align: center; }

/* ══════════════════════════════════════════════════════════════════
   PLANNING VIEW (Gantt)
   ══════════════════════════════════════════════════════════════════ */
.planning-view { padding: 22px 0; overflow-x: auto; }

.planning-table {
  min-width: 100%; border-collapse: collapse; font-size: 13px;
}
.planning-table th, .planning-table td {
  border: 1px solid var(--border); padding: 0;
}

.plan-week-header {
  background: var(--topbar-bg); color: rgba(255,255,255,.9);
  text-align: center; font-size: 11px; font-weight: 700;
  padding: 4px 6px; letter-spacing: .05em;
}
.plan-day-header {
  background: var(--surface-2); text-align: center; font-size: 11px;
  font-weight: 600; padding: 6px 4px; white-space: nowrap;
  min-width: 84px; color: var(--text-muted);
}
.plan-day-header.today-col { background: var(--blue-light); color: var(--blue); }
.plan-day-header .day-num  { font-size: 14px; font-weight: 700; color: var(--text); }
.plan-day-header.today-col .day-num { color: var(--blue); }

.plan-task-col {
  background: var(--surface); padding: 7px 14px; white-space: nowrap;
  min-width: 190px; max-width: 270px;
  border-right: 2px solid var(--border);
  position: sticky; left: 0; z-index: 1; cursor: pointer;
}
.plan-task-col:hover { background: var(--blue-light); }
.plan-task-label { font-weight: 500; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.plan-task-label.is-done { text-decoration: line-through; color: var(--text-muted); }
.plan-task-resp  { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.plan-cell { background: var(--surface); padding: 0; text-align: center; vertical-align: middle; }
.plan-cell.today-col { background: rgba(59,91,219,.04); }

.plan-deadline-marker {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; padding: 8px 4px;
  font-size: 11px; font-weight: 700; border-radius: 4px; cursor: pointer;
}
.marker-nouveau   { background: var(--nouveau-bg); color: var(--nouveau-fg); }
.marker-en_cours  { background: var(--encours-bg); color: var(--encours-fg); }
.marker-bloque    { background: var(--bloque-bg);  color: var(--bloque-fg);  }
.marker-termine   { background: var(--termine-bg); color: var(--termine-fg); }

.plan-section-row td {
  background: var(--surface-2); padding: 5px 14px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-faint);
}

/* ══════════════════════════════════════════════════════════════════
   TASK MODAL
   ══════════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.35);
  z-index: 1000; display: flex; align-items: flex-start; justify-content: flex-end;
  padding: var(--topbar-h) 0 0;
  animation: fadeIn .15s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-panel {
  background: var(--surface); width: 490px; max-width: 100vw;
  height: calc(100vh - var(--topbar-h));
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 32px rgba(0,0,0,.1);
  display: flex; flex-direction: column;
  animation: slideIn .18s ease-out;
}
@keyframes slideIn { from { transform: translateX(60px); } to { transform: translateX(0); } }

.modal-close {
  position: absolute; top: calc(var(--topbar-h) + 12px); right: 14px;
  width: 32px; height: 32px; border: none; background: none;
  font-size: 22px; cursor: pointer; color: var(--text-muted); border-radius: var(--radius-sm);
  z-index: 10; transition: background .12s, color .12s;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }

.modal-header { padding: 22px 26px 18px; border-bottom: 1px solid var(--border); }
.modal-badges {
  display: flex; flex-direction: row; align-items: flex-start;
  justify-content: space-between;
  gap: 12px; margin-top: 14px;
}
.modal-badges-left  { display: flex; flex-direction: column; gap: 6px; }
.modal-badges-right { display: flex; flex-direction: column; gap: 6px; }

.modal-badge-row { display: flex; align-items: center; gap: 10px; }

.modal-badge-label {
  font-size: 11px; font-weight: 600; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: .06em;
  flex-shrink: 0;
}
.badge-section { background: #f0f0f0; color: #555; }

.modal-title  { font-size: 17px; font-weight: 700; line-height: 1.38; margin-bottom: 6px; letter-spacing: -.1px; }
.modal-meta   { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--text-muted); }
.modal-meta-item { display: flex; align-items: center; gap: 4px; }

.modal-body { flex: 1; overflow-y: auto; padding: 22px 26px; }

.notes-body { font-size: 14.5px; line-height: 1.7; }
.notes-has-previews {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  margin-top: 6px;
}

/* Intro : texte avant le premier H2 */
.notes-intro {
  font-size: 15.5px; line-height: 1.85;
  color: var(--text);
  padding-bottom: 18px; margin-bottom: 18px;
  border-bottom: 1px solid var(--border-light);
}
.notes-intro p  { margin-bottom: 10px; }
.notes-intro p:last-child { margin-bottom: 0; }
.notes-intro ul, .notes-intro ol { padding-left: 22px; margin-bottom: 10px; }
.notes-intro li { margin-bottom: 4px; }

.modal-notes { line-height: 1.7; }
.modal-notes p  { margin-bottom: 10px; }
.modal-notes h1 { margin: 20px 0 8px; font-size: 16px; font-weight: 700; }
.modal-notes h2 { margin: 22px 0 8px; font-size: 15px; font-weight: 700; color: #990000; }
.modal-notes h3 { margin: 16px 0 6px; font-size: 14px; font-weight: 700; color: var(--text-muted); }
.modal-notes ul, .modal-notes ol { padding-left: 22px; margin-bottom: 10px; }
.modal-notes li { margin-bottom: 3px; }
.modal-notes code {
  background: var(--surface-2); padding: 1px 6px;
  border-radius: 4px; font-size: 12px; border: 1px solid var(--border-light);
}
.modal-notes pre {
  background: var(--surface-2); padding: 14px; border-radius: var(--radius-sm);
  overflow-x: auto; margin: 10px 0; border: 1px solid var(--border);
}
.modal-notes pre code { background: none; padding: 0; border: none; }
.modal-notes blockquote {
  border-left: 3px solid var(--border); padding-left: 14px;
  color: var(--text-muted); margin: 10px 0;
}
.modal-notes a { color: var(--blue); }
.modal-notes img { max-width: 100%; border-radius: var(--radius-sm); margin: 8px 0; }

/* ── Liens Missive (modal) ──────────────────────────────────────── */
.missive-card {
  display: flex; align-items: flex-start; gap: 12px;
  border: 1.5px solid var(--border-light); border-radius: var(--radius);
  padding: 12px 14px; background: var(--surface-2);
  margin: 8px 0;
}
.missive-card-icon {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: var(--radius-sm);
  background: #e8f4fd; color: #1565c0;
  display: flex; align-items: center; justify-content: center;
}
.missive-icon-loading {
  background: var(--border-light);
  animation: pulse .8s ease-in-out infinite alternate;
}
.missive-card-body  { flex: 1; min-width: 0; }
.missive-card-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.missive-card-meta  { display: flex; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.missive-card-count        { font-size: 11px; font-weight: 600; color: var(--encours-fg); background: var(--encours-bg); padding: 1px 7px; border-radius: 20px; }
.missive-card-participants { font-size: 12px; color: var(--text-muted); margin: 4px 0; }
.missive-card-summary-wrap { margin: 8px 0; }
.missive-card-summary-label { font-size: 11px; color: var(--text-faint); margin-bottom: 4px; }
.missive-card-summary {
  font-size: 12px; color: var(--text-muted); line-height: 1.6;
  max-height: 130px; overflow-y: auto;
  border-left: 2px solid var(--border); padding-left: 10px;
}
.missive-summary-line { margin-bottom: 4px; }
.missive-summary-line:last-child { margin-bottom: 0; }
.missive-card-link  { font-size: 11px; color: var(--blue); text-decoration: none; margin-top: 6px; display: inline-block; }
.missive-card-link:hover { text-decoration: underline; }
.missive-card-error .missive-card-title { color: var(--text-muted); font-weight: 400; }

/* ── Loader page Missive ────────────────────────────────────────── */
.thread-loader {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 16px;
  padding: 80px 20px; color: var(--text-muted);
}
.thread-loader-spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.thread-loader-label { font-size: 13px; }
.thread-error {
  padding: 60px 26px; text-align: center;
  color: var(--bloque-fg);
}

/* ── Page fil de discussion Missive ─────────────────────────────── */
.missive-thread-page  { max-width: 780px; margin: 0 auto; padding: 28px 26px 60px; }
.missive-thread-header {
  display: flex; align-items: baseline; gap: 14px;
  margin-bottom: 28px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.missive-thread-title { font-size: 20px; font-weight: 700; flex: 1; }
.missive-thread-count { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.missive-thread-list  { display: flex; flex-direction: column; gap: 20px; }

.missive-msg {
  background: var(--surface); border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg); overflow: hidden;
}
.missive-msg-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; background: var(--surface-2);
  border-bottom: 1px solid var(--border-light);
}
.missive-msg-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--blue), #6b83e0);
  color: #fff; font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.missive-msg-from   { flex: 1; min-width: 0; }
.missive-msg-name   { font-size: 13px; font-weight: 600; }
.missive-msg-address { font-size: 11px; color: var(--text-muted); }
.missive-msg-date   { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.missive-msg-body   {
  padding: 18px 20px; font-size: 13px; line-height: 1.7; color: var(--text);
  overflow-x: auto;
}
.missive-msg-body p  { margin-bottom: 10px; }
.missive-msg-body p:last-child { margin-bottom: 0; }
.missive-msg-body blockquote {
  border-left: 3px solid var(--border); padding-left: 12px;
  color: var(--text-muted); margin: 10px 0; font-size: 12px;
}

/* ── Liens Plutio (modal) ───────────────────────────────────────── */
.board-section { margin-bottom: 22px; }

.board-list { display: flex; flex-direction: column; gap: 8px; }

.board-card {
  display: flex; align-items: center; gap: 14px;
  border: 1.5px solid var(--border-light); border-radius: var(--radius);
  padding: 12px 14px; background: var(--surface-2);
  transition: box-shadow .15s, border-color .15s;
}
.board-card:hover { box-shadow: var(--shadow-sm); border-color: var(--blue-mid); }

/* Logo thumbnail */
.board-card-thumb {
  width: 52px; height: 52px; flex-shrink: 0; border-radius: var(--radius-sm);
  background: #4B45D4;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.board-card-thumb-loading {
  animation: pulse .8s ease-in-out infinite alternate;
}
.board-card-logo {
  width: 44px; height: 44px; object-fit: contain;
}
@keyframes pulse { from { opacity: .4; } to { opacity: 1; } }

.board-card-info { flex: 1; min-width: 0; }
.board-card-title {
  font-size: 13px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.board-card-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.board-card-type {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700; color: var(--mediablue-fg);
  background: var(--mediablue-bg); padding: 2px 8px; border-radius: 20px;
}
.board-card-type svg { width: 11px; height: 11px; }
.board-card-ref    { font-size: 11px; color: var(--text-faint); }
.board-card-status { font-size: 11px; color: var(--text-muted); font-style: italic; }
.board-card-amount { font-size: 11px; font-weight: 600; color: var(--termine-fg); margin-left: auto; }
.board-card-link   { font-size: 11px; color: var(--blue); margin-top: 4px; }
.board-card-error .board-card-title { color: var(--text-muted); font-weight: 400; font-style: italic; }
.board-card-error .board-card-meta  { color: var(--bloque-fg); }

/* ── Fichiers attachés (modal) ──────────────────────────────────── */
.files-section { margin-bottom: 22px; }
.files-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-faint); margin-bottom: 10px;
}

/* PDFs : 1 par ligne */
.files-list-pdfs { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }

/* Images : 2 par ligne */
.files-list-images {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}

.file-preview-card {
  display: flex; align-items: center; gap: 12px;
  border: 1.5px solid var(--border-light); border-radius: var(--radius);
  padding: 10px 12px; background: var(--surface-2);
  text-decoration: none; color: inherit;
  min-width: 0; overflow: hidden;           /* empêche le débordement */
  transition: box-shadow .15s, border-color .15s;
}
.file-preview-card:hover {
  box-shadow: var(--shadow-sm); border-color: var(--blue-mid);
  text-decoration: none;
}
.file-preview-thumb {
  width: 52px; height: 52px; flex-shrink: 0;
  border-radius: var(--radius-sm); overflow: hidden;
  background: var(--border-light);
  display: flex; align-items: center; justify-content: center;
}
.file-preview-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.file-preview-info {
  flex: 1; min-width: 0; overflow: hidden;  /* clé du tronquage */
}
.file-preview-name {
  font-size: 12px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 5px;
  min-width: 0; overflow: hidden;
}
.file-preview-name-text {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0;
}
.file-type-icon { width: 13px; height: 13px; flex-shrink: 0; }
.is-pdf   .file-type-icon { color: #dc2626; }
.is-image .file-type-icon { color: #0891b2; }
.file-preview-dl { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

.modal-checklist-wrap { margin-top: 22px; }
.checklist-heading {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-faint); margin-bottom: 10px;
}
.checklist { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.checklist li {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 13px; padding: 7px 12px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border-light);
}
.checklist li.done { color: var(--text-muted); }
.checklist-icon { flex-shrink: 0; font-size: 18px; margin-top: 0; line-height: 1; }
.checklist li.done .checklist-text { text-decoration: line-through; }
.checklist-date {
  margin-left: auto; flex-shrink: 0;
  font-size: 11px; font-weight: 600;
  color: var(--text-faint); white-space: nowrap;
  padding: 1px 7px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--border-light);
}
.checklist-date.overdue { color: var(--bloque-fg); background: var(--bloque-bg); border-color: transparent; }
.checklist-date.soon    { color: #92400e; background: var(--client-bg); border-color: transparent; }

.modal-footer { padding: 12px 26px; border-top: 1px solid var(--border); }

.btn-permalink {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; color: var(--text-faint);
  text-decoration: none; padding: 5px 10px; border-radius: var(--radius-sm);
  transition: background .12s, color .12s;
}
.btn-permalink:hover { background: var(--surface-2); color: var(--text-muted); text-decoration: none; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .kanban-view  { padding: 12px; }
  .kanban-col   { flex: 0 0 248px; }
  .modal-panel  { width: 100vw; }
  .project-toolbar { flex-wrap: wrap; padding: 8px 14px; }
  .toolbar-filters { margin-left: 0; }
}

/* ── Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }
