/* ==========================================================================
   AGMTEC SEO — feuille de style applicative (complète Bootstrap 5.3)
   ========================================================================== */

:root {
  --agm-sidebar-w: 276px;
  --agm-topbar-h: 62px;

  --agm-brand: #2563eb;
  --agm-brand-600: #1d4ed8;
  --agm-brand-050: #eff6ff;

  --agm-clicks: #4f46e5;
  --agm-impressions: #0ea5e9;
  --agm-ctr: #10b981;
  --agm-position: #f59e0b;

  --agm-bg: #f6f7fb;
  --agm-surface: #ffffff;
  --agm-border: #e6e8ef;
  --agm-text: #111827;
  --agm-muted: #6b7280;

  --agm-side-bg: #0f172a;
  --agm-side-bg-soft: #1e293b;
  --agm-side-text: #cbd5e1;
  --agm-side-text-dim: #64748b;
  --agm-side-active: #2563eb;

  --agm-radius: 12px;
  --agm-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --agm-shadow-lg: 0 8px 24px rgba(16, 24, 40, .10);
}

[data-bs-theme="dark"] {
  --agm-bg: #0b1120;
  --agm-surface: #131c31;
  --agm-border: #24314e;
  --agm-text: #e5e7eb;
  --agm-muted: #94a3b8;
  --agm-side-bg: #070d1a;
  --agm-side-bg-soft: #101a2e;
  --agm-brand-050: #16233d;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

body {
  background: var(--agm-bg);
  color: var(--agm-text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: .9375rem;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }
h1, h2, h3, h4, h5, h6 { font-weight: 650; letter-spacing: -.011em; }

.text-muted-2 { color: var(--agm-muted) !important; }
.fs-13 { font-size: .8125rem; }
.fs-12 { font-size: .75rem; }
.fw-650 { font-weight: 650; }
.mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; }

/* --------------------------------------------------------------------------
   Structure
   -------------------------------------------------------------------------- */

.app-shell { min-height: 100vh; }

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--agm-sidebar-w);
  background: var(--agm-side-bg);
  color: var(--agm-side-text);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform .25s ease;
}

.app-main {
  margin-left: var(--agm-sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  height: var(--agm-topbar-h);
  background: color-mix(in srgb, var(--agm-surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--agm-border);
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 0 1.25rem;
}

.app-content { padding: 1.25rem; flex: 1 1 auto; }
.app-footer {
  padding: .9rem 1.25rem;
  border-top: 1px solid var(--agm-border);
  color: var(--agm-muted);
  font-size: .78rem;
}

@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); box-shadow: var(--agm-shadow-lg); }
  .app-sidebar.is-open { transform: translateX(0); }
  .app-main { margin-left: 0; }
  .app-content { padding: 1rem .85rem; }
  .sidebar-backdrop {
    position: fixed; inset: 0; background: rgba(2, 6, 23, .5);
    z-index: 1035; opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .sidebar-backdrop.is-open { opacity: 1; pointer-events: auto; }
}

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */

.sidebar-brand {
  display: flex; align-items: center; gap: .65rem;
  padding: 1rem 1.15rem; color: #fff; font-weight: 700; font-size: 1.02rem;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  letter-spacing: -.02em;
}
.sidebar-brand .brand-mark {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  display: grid; place-items: center; color: #fff; font-size: 1rem;
  box-shadow: 0 2px 8px rgba(59, 130, 246, .45);
}
.sidebar-brand small { display: block; font-size: .68rem; font-weight: 500; color: var(--agm-side-text-dim); }

/* Sélecteur de projet */
.project-switcher { padding: .85rem .85rem .55rem; border-bottom: 1px solid rgba(255,255,255,.07); }
.project-switcher-label {
  font-size: .66rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--agm-side-text-dim); font-weight: 700; margin: 0 .25rem .4rem;
}
.project-switcher .btn-switch {
  width: 100%; display: flex; align-items: center; gap: .6rem;
  background: var(--agm-side-bg-soft); border: 1px solid rgba(255,255,255,.09);
  color: #e2e8f0; border-radius: 10px; padding: .55rem .65rem; text-align: left;
  transition: border-color .15s, background .15s;
}
.project-switcher .btn-switch:hover { border-color: rgba(255,255,255,.22); background: #24334d; }
.project-switcher .btn-switch .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.project-switcher .btn-switch .names { min-width: 0; flex: 1; }
.project-switcher .btn-switch .names strong {
  display: block; font-size: .855rem; font-weight: 600; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.project-switcher .btn-switch .names span {
  display: block; font-size: .7rem; color: var(--agm-side-text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.project-menu {
  width: calc(var(--agm-sidebar-w) - 1.7rem);
  max-height: 60vh; overflow: hidden;
  padding: .5rem; border-radius: 12px; box-shadow: var(--agm-shadow-lg);
}
.project-menu .project-search { position: sticky; top: 0; padding-bottom: .45rem; }
.project-menu .project-list { max-height: 44vh; overflow-y: auto; }
.project-menu .dropdown-item { border-radius: 8px; padding: .45rem .6rem; display: flex; align-items: center; gap: .55rem; }
.project-menu .dropdown-item small { color: var(--agm-muted); font-size: .7rem; display: block; }
.project-menu .dropdown-item.active,
.project-menu .dropdown-item:active { background: var(--agm-brand); color: #fff; }
.project-menu .dropdown-item.active small { color: rgba(255,255,255,.8); }

/* Navigation */
.sidebar-nav { flex: 1 1 auto; overflow-y: auto; padding: .6rem .65rem 1.5rem; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }

.nav-section {
  font-size: .655rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--agm-side-text-dim); font-weight: 700;
  padding: 1rem .7rem .35rem;
}
.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: .65rem;
  color: var(--agm-side-text); border-radius: 9px;
  padding: .5rem .7rem; font-size: .855rem; font-weight: 500;
  margin-bottom: 1px; transition: background .12s, color .12s;
}
.sidebar-nav .nav-link i { font-size: 1rem; width: 1.15rem; text-align: center; opacity: .85; }
.sidebar-nav .nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--agm-side-active); color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,.35); }
.sidebar-nav .nav-link.active i { opacity: 1; }
.sidebar-nav .nav-link .badge { margin-left: auto; font-size: .64rem; }

/* Sous-menu repliable : les cinq tableaux d'analyse tiennent sur une ligne. */
.sidebar-nav .nav-parent { cursor: pointer; }
.sidebar-nav .nav-parent.active-branch { color: #fff; }
.nav-caret { font-size: .7rem; opacity: .55; transition: transform .18s; }
.nav-parent[aria-expanded="true"] .nav-caret { transform: rotate(180deg); }
.nav-sub {
  margin: 1px 0 3px .95rem;
  padding-left: .5rem;
  border-left: 1px solid rgba(255, 255, 255, .1);
}
.sidebar-nav .nav-sub .nav-link { padding: .38rem .6rem; font-size: .805rem; }
.sidebar-nav .nav-sub .nav-link i { font-size: .875rem; }

.sidebar-foot {
  border-top: 1px solid rgba(255,255,255,.07); padding: .75rem .85rem;
  font-size: .72rem; color: var(--agm-side-text-dim);
}

/* --------------------------------------------------------------------------
   Topbar
   -------------------------------------------------------------------------- */

.topbar-title { font-size: 1.02rem; font-weight: 650; margin: 0; letter-spacing: -.015em; }
.topbar-sub { font-size: .74rem; color: var(--agm-muted); }

.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; color: #fff;
  font-size: .78rem; font-weight: 650; flex: none;
}
.avatar-sm { width: 26px; height: 26px; font-size: .65rem; }
.avatar-lg { width: 46px; height: 46px; font-size: 1rem; }

/* --------------------------------------------------------------------------
   Cartes & KPI
   -------------------------------------------------------------------------- */

.card {
  background: var(--agm-surface);
  border: 1px solid var(--agm-border);
  border-radius: var(--agm-radius);
  box-shadow: var(--agm-shadow);
}
.card-header {
  background: transparent; border-bottom: 1px solid var(--agm-border);
  padding: .85rem 1.1rem; font-weight: 620; font-size: .92rem;
  display: flex; align-items: center; gap: .55rem;
}
.card-body { padding: 1.1rem; }

.kpi-card {
  position: relative; overflow: hidden; cursor: pointer;
  border-top: 3px solid transparent; transition: box-shadow .15s, transform .15s;
}
.kpi-card:hover { box-shadow: var(--agm-shadow-lg); }
.kpi-card.is-on { border-top-color: var(--agm-accent, var(--agm-brand)); background: var(--agm-surface); }
.kpi-card.is-off { opacity: .62; }
.kpi-label {
  font-size: .73rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--agm-muted); font-weight: 650; display: flex; align-items: center; gap: .4rem;
}
.kpi-label .swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--agm-accent); }
.kpi-value { font-size: 1.85rem; font-weight: 700; line-height: 1.15; letter-spacing: -.025em; margin: .3rem 0 .15rem; }
.kpi-prev { font-size: .74rem; color: var(--agm-muted); }

.trend {
  display: inline-flex; align-items: center; gap: .18rem;
  font-size: .74rem; font-weight: 650; padding: .12rem .42rem;
  border-radius: 999px; white-space: nowrap;
}
.trend i { font-size: .78rem; }
.trend-up   { background: #dcfce7; color: #15803d; }
.trend-down { background: #fee2e2; color: #b91c1c; }
.trend-flat { background: #f1f5f9; color: #64748b; }
.trend-new  { background: #ede9fe; color: #6d28d9; }
[data-bs-theme="dark"] .trend-up   { background: rgba(22,163,74,.18); color: #4ade80; }
[data-bs-theme="dark"] .trend-down { background: rgba(220,38,38,.18); color: #f87171; }
[data-bs-theme="dark"] .trend-flat { background: rgba(100,116,139,.2); color: #cbd5e1; }
[data-bs-theme="dark"] .trend-new  { background: rgba(139,92,246,.2); color: #c4b5fd; }

/* --------------------------------------------------------------------------
   Graphiques
   -------------------------------------------------------------------------- */

.chart-wrap { position: relative; width: 100%; }
.chart-h-sm  { height: 190px; }
.chart-h-md  { height: 300px; }
.chart-h-lg  { height: 380px; }
.sparkline { height: 38px; width: 110px; }

/* --------------------------------------------------------------------------
   Tableaux
   -------------------------------------------------------------------------- */

.table-agm { margin: 0; font-size: .865rem; }
.table-agm > :not(caption) > * > * { padding: .62rem .85rem; }
.table-agm thead th {
  background: var(--agm-bg); color: var(--agm-muted);
  font-size: .71rem; text-transform: uppercase; letter-spacing: .05em;
  font-weight: 700; border-bottom: 1px solid var(--agm-border); white-space: nowrap;
}
.table-agm thead th a { color: inherit; display: inline-flex; align-items: center; gap: .25rem; }
.table-agm thead th a:hover { color: var(--agm-brand); }
.table-agm tbody tr:hover { background: var(--agm-brand-050); }
.table-agm td.num, .table-agm th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-agm .dim-cell { max-width: 460px; }
.table-agm .dim-cell .val { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rank-bar {
  height: 4px; border-radius: 2px; background: var(--agm-brand);
  opacity: .28; margin-top: .28rem;
}

/* Bulle d'aide dans les en-têtes de colonnes */
.th-help {
  opacity: .38; font-size: .95em; cursor: help;
  transition: opacity .12s, color .12s;
}
.th-help:hover { opacity: 1; color: var(--agm-brand); }

/* Encart « Comprendre ces colonnes » */
.help-block {
  background: var(--agm-surface);
  border: 1px solid var(--agm-border);
  border-radius: var(--agm-radius);
  overflow: hidden;
}
.help-toggle {
  width: 100%; display: flex; align-items: center; gap: .55rem;
  background: transparent; border: 0; color: var(--agm-text);
  padding: .65rem .95rem; font-size: .855rem; font-weight: 600; text-align: left;
}
.help-toggle:hover { background: var(--agm-brand-050); }
.help-toggle > .bi-info-circle-fill { color: var(--agm-brand); }
.help-toggle > .bi-chevron-down { font-size: .75rem; opacity: .5; transition: transform .2s; }
.help-toggle[aria-expanded="true"] > .bi-chevron-down { transform: rotate(180deg); }

.help-body {
  padding: .25rem .95rem 1rem;
  border-top: 1px solid var(--agm-border);
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .1rem 2rem;
}
@media (max-width: 991.98px) { .help-body { grid-template-columns: 1fr; } }
.help-item { padding: .5rem 0; border-bottom: 1px dashed var(--agm-border); }
.help-item:last-child { border-bottom: 0; }
.help-term {
  display: block; font-size: .8rem; font-weight: 700; color: var(--agm-text);
  margin-bottom: .1rem;
}
.help-term::before {
  content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--agm-brand); margin-right: .45rem; vertical-align: middle;
}
.help-def { display: block; font-size: .8rem; line-height: 1.5; color: var(--agm-muted); }

/* --------------------------------------------------------------------------
   Éditeur de texte enrichi (Tiptap)
   -------------------------------------------------------------------------- */

.rt-editor {
  border: 1px solid var(--agm-border);
  border-radius: 10px;
  background: var(--agm-surface);
  overflow: hidden;
}
.rt-editor:focus-within { border-color: var(--agm-brand); box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--agm-brand) 15%, transparent); }

.rt-toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: .1rem;
  padding: .35rem .4rem;
  border-bottom: 1px solid var(--agm-border);
  background: var(--agm-bg);
}
.rt-sep { width: 1px; height: 18px; background: var(--agm-border); margin: 0 .3rem; }

.rt-btn {
  border: 0; background: transparent; color: var(--agm-text);
  border-radius: 6px; padding: .25rem .45rem; font-size: .85rem; line-height: 1.4;
  display: inline-flex; align-items: center; gap: .3rem;
}
.rt-btn:hover { background: color-mix(in srgb, var(--agm-brand) 12%, transparent); color: var(--agm-brand); }
.rt-btn.is-active { background: var(--agm-brand); color: #fff; }
.rt-btn:disabled { opacity: .5; }
.rt-btn.rt-ai {
  background: color-mix(in srgb, #7c3aed 12%, transparent); color: #6d28d9;
  font-size: .78rem; font-weight: 600; padding: .25rem .6rem;
}
.rt-btn.rt-ai:hover { background: #7c3aed; color: #fff; }
[data-bs-theme="dark"] .rt-btn.rt-ai { color: #c4b5fd; }

.rt-area { min-height: 170px; max-height: 460px; overflow-y: auto; }
.rt-area .ProseMirror { padding: .7rem .85rem; outline: none; font-size: .9rem; line-height: 1.55; }

/* Espacement : un seul appui sur Entrée doit déjà se voir, sans excès.
   Les marges sont posées explicitement par type de bloc — un sélecteur
   générique « * + * » serait battu par la règle sur p et laisserait les
   paragraphes collés, ce qui pousse à doubler les retours à la ligne. */
.rt-area .ProseMirror > * { margin: 0 0 .5rem; }
.rt-area .ProseMirror > *:last-child { margin-bottom: 0; }
.rt-area .ProseMirror h2 { font-size: 1.1rem; margin: 1rem 0 .4rem; font-weight: 650; }
.rt-area .ProseMirror h3 { font-size: 1rem;  margin: .85rem 0 .35rem; font-weight: 650; }
.rt-area .ProseMirror h2:first-child,
.rt-area .ProseMirror h3:first-child { margin-top: 0; }
.rt-area .ProseMirror ul,
.rt-area .ProseMirror ol { padding-left: 1.25rem; }
.rt-area .ProseMirror li { margin: 0; }
.rt-area .ProseMirror li > p { margin: 0; }          /* Tiptap emballe les items dans un p */
.rt-area .ProseMirror li + li { margin-top: .15rem; }
.rt-area .ProseMirror blockquote {
  border-left: 3px solid var(--agm-border); padding-left: .8rem; color: var(--agm-muted);
}

/* Un paragraphe vide doit valoir une ligne, pas deux : le <br> de remplissage
   ajouté par le navigateur s'empile sinon sur la hauteur de ligne du bloc. */
.rt-area .ProseMirror p:empty::before { content: ""; display: inline-block; }
.rt-area .ProseMirror p > br.ProseMirror-trailingBreak:only-child { display: none; }
.rt-area .ProseMirror p:has(> br:only-child) { min-height: 1.55em; }
.rt-area .ProseMirror p > br:only-child { display: none; }
.rt-area .ProseMirror code {
  background: var(--agm-bg); padding: .1rem .3rem; border-radius: 4px;
  font-size: .85em; font-family: ui-monospace, Consolas, monospace;
}
.rt-area .ProseMirror pre {
  background: var(--agm-bg); padding: .6rem .8rem; border-radius: 8px; overflow-x: auto;
}
.rt-area .ProseMirror a { color: var(--agm-brand); text-decoration: underline; }
.rt-area .ProseMirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder); color: var(--agm-muted); float: left; height: 0; pointer-events: none;
}

.rt-prompt {
  padding: .6rem .85rem; border-top: 1px solid var(--agm-border);
  background: color-mix(in srgb, #7c3aed 6%, transparent);
}
.rt-ai-error {
  display: none; padding: .5rem .85rem; border-top: 1px solid var(--agm-border);
  background: #fee2e2; color: #b91c1c; font-size: .8rem;
}
[data-bs-theme="dark"] .rt-ai-error { background: rgba(220,38,38,.2); color: #fca5a5; }

/* Rendu du contenu enregistré, hors édition — mêmes règles que l'éditeur,
   pour que l'aperçu corresponde exactement à ce qui a été saisi. */
.rt-content { font-size: .9rem; line-height: 1.55; }
.rt-content > * { margin: 0 0 .5rem; }
.rt-content > *:last-child { margin-bottom: 0; }
.rt-content h2 { font-size: 1.08rem; margin: 1rem 0 .4rem; font-weight: 650; }
.rt-content h3 { font-size: .98rem; margin: .85rem 0 .35rem; font-weight: 650; }
.rt-content h2:first-child, .rt-content h3:first-child { margin-top: 0; }
.rt-content ul, .rt-content ol { padding-left: 1.25rem; }
.rt-content li { margin: 0; }
.rt-content li > p { margin: 0; }
.rt-content li + li { margin-top: .15rem; }
.rt-content blockquote {
  border-left: 3px solid var(--agm-border); padding-left: .8rem; color: var(--agm-muted);
}
.rt-content code {
  background: var(--agm-bg); padding: .1rem .3rem; border-radius: 4px; font-size: .85em;
}
.rt-content pre { background: var(--agm-bg); padding: .6rem .8rem; border-radius: 8px; overflow-x: auto; }

/* --------------------------------------------------------------------------
   Pièces jointes et zone de dépôt
   -------------------------------------------------------------------------- */

.dropzone {
  border: 2px dashed var(--agm-border); border-radius: 10px;
  padding: 1.1rem; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover { border-color: var(--agm-brand); background: var(--agm-brand-050); }
.dropzone.is-over { border-color: var(--agm-brand); background: var(--agm-brand-050); }
.dropzone i { font-size: 1.5rem; color: var(--agm-brand); opacity: .7; }
.dropzone .dz-hint { font-size: .78rem; color: var(--agm-muted); }

.att-list { display: flex; flex-direction: column; gap: .3rem; }
.att-item {
  display: flex; align-items: center; gap: .55rem;
  border: 1px solid var(--agm-border); border-radius: 8px;
  padding: .4rem .6rem; font-size: .82rem; background: var(--agm-surface);
}
.att-item i.att-ico { font-size: 1rem; color: var(--agm-brand); flex: none; }
.att-item .att-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-item .att-meta { color: var(--agm-muted); font-size: .72rem; white-space: nowrap; }
.att-item.is-pending { border-style: dashed; opacity: .75; }

/* --------------------------------------------------------------------------
   Kanban : glisser-déposer
   -------------------------------------------------------------------------- */

/* Un clic ouvre la fiche ; le glissement se prend par la poignée ou la carte */
.task-card { cursor: pointer; }
.task-card.is-dragging { opacity: .45; cursor: grabbing; }
.kanban-body.is-drop-target {
  outline: 2px dashed var(--agm-brand); outline-offset: -4px;
  background: var(--agm-brand-050); border-radius: 8px;
}
.task-card .t-grip { color: var(--agm-muted); opacity: .35; cursor: grab; font-size: .8rem; }
.task-card:hover .t-grip { opacity: .8; }

.progress-quick { display: flex; align-items: center; gap: .4rem; }
.progress-quick input[type=range] { flex: 1; height: 4px; }

.table-empty { padding: 3rem 1rem; text-align: center; color: var(--agm-muted); }
.table-empty i { font-size: 2.2rem; opacity: .35; display: block; margin-bottom: .6rem; }

/* --------------------------------------------------------------------------
   Périodes & filtres
   -------------------------------------------------------------------------- */

.period-btn {
  background: var(--agm-surface); border: 1px solid var(--agm-border);
  border-radius: 9px; padding: .38rem .7rem; font-size: .82rem;
  display: inline-flex; align-items: center; gap: .45rem; color: var(--agm-text);
}
.period-btn:hover { border-color: var(--agm-brand); color: var(--agm-brand); }

.filter-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--agm-brand-050); color: var(--agm-brand-600);
  border: 1px solid color-mix(in srgb, var(--agm-brand) 25%, transparent);
  border-radius: 999px; padding: .2rem .6rem; font-size: .76rem; font-weight: 600;
}
.filter-chip a { color: inherit; opacity: .7; }
.filter-chip a:hover { opacity: 1; }

/* --------------------------------------------------------------------------
   Tâches (kanban + liste)
   -------------------------------------------------------------------------- */

.kanban { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .85rem; }
@media (max-width: 1199.98px) { .kanban { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767.98px)  { .kanban { grid-template-columns: 1fr; } }

.kanban-col { background: var(--agm-surface); border: 1px solid var(--agm-border); border-radius: var(--agm-radius); display: flex; flex-direction: column; }
.kanban-head {
  padding: .7rem .85rem; border-bottom: 1px solid var(--agm-border);
  font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  display: flex; align-items: center; gap: .45rem;
}
.kanban-head .count { margin-left: auto; background: var(--agm-bg); border-radius: 999px; padding: .05rem .5rem; font-size: .72rem; }
.kanban-body { padding: .6rem; display: flex; flex-direction: column; gap: .55rem; min-height: 80px; }

.task-card {
  border: 1px solid var(--agm-border); border-radius: 10px; padding: .65rem .7rem;
  background: var(--agm-surface); border-left: 3px solid var(--agm-accent, var(--agm-brand));
  transition: box-shadow .15s;
}
.task-card:hover { box-shadow: var(--agm-shadow); }
.task-card .t-title { font-size: .85rem; font-weight: 600; line-height: 1.3; }
.task-card .t-meta { font-size: .7rem; color: var(--agm-muted); display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.task-card.is-late { border-left-color: #dc2626; }

.progress-thin { height: 6px; border-radius: 999px; background: var(--agm-bg); }

/* --------------------------------------------------------------------------
   Chronologie des actions réalisées
   -------------------------------------------------------------------------- */

.timeline { position: relative; padding-left: 1.6rem; }
.timeline::before {
  content: ""; position: absolute; left: .43rem; top: .3rem; bottom: .3rem;
  width: 2px; background: var(--agm-border);
}

.tl-month {
  position: relative; margin: 1.1rem 0 .7rem -1.6rem;
  font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--agm-muted);
}
.tl-month:first-child { margin-top: 0; }

.tl-item { position: relative; padding-bottom: 1rem; }
.tl-item:last-child { padding-bottom: 0; }

.tl-dot {
  position: absolute; left: -1.6rem; top: .1rem;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--agm-surface); border: 2px solid var(--tl-color, var(--agm-brand));
  color: var(--tl-color, var(--agm-brand));
  display: grid; place-items: center; font-size: .55rem;
}

.tl-body {
  background: var(--agm-surface); border: 1px solid var(--agm-border);
  border-left: 3px solid var(--tl-color, var(--agm-brand));
  border-radius: 10px; padding: .65rem .8rem; transition: box-shadow .15s;
}
.tl-body:hover { box-shadow: var(--agm-shadow); }

.tl-when  { font-size: .72rem; font-weight: 650; color: var(--agm-muted); }
.tl-title { font-size: .92rem; font-weight: 650; line-height: 1.35; margin-top: .1rem; }
.tl-text  { font-size: .8rem; color: var(--agm-muted); margin-top: .25rem; }
.tl-meta  {
  margin-top: .45rem; font-size: .72rem; color: var(--agm-muted);
  display: flex; align-items: center; gap: .55rem; flex-wrap: wrap;
}
.tl-meta .badge { font-size: .68rem; font-weight: 650; }

/* --------------------------------------------------------------------------
   Divers
   -------------------------------------------------------------------------- */

.stat-pill {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--agm-bg); border: 1px solid var(--agm-border);
  border-radius: 999px; padding: .22rem .7rem; font-size: .78rem; font-weight: 600;
}

.verdict-PASS    { color: #15803d; }
.verdict-PARTIAL { color: #b45309; }
.verdict-FAIL    { color: #b91c1c; }
.verdict-NEUTRAL { color: #64748b; }

.empty-state { text-align: center; padding: 3.5rem 1.5rem; }
.empty-state i { font-size: 3rem; color: var(--agm-brand); opacity: .35; }
.empty-state h5 { margin: 1rem 0 .4rem; }
.empty-state p { color: var(--agm-muted); max-width: 460px; margin: 0 auto 1.2rem; }

.form-label { font-size: .82rem; font-weight: 600; margin-bottom: .3rem; }
.form-text { font-size: .76rem; }
.form-control, .form-select { border-color: var(--agm-border); }
.form-control:focus, .form-select:focus {
  border-color: var(--agm-brand); box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--agm-brand) 18%, transparent);
}

.btn { border-radius: 9px; font-weight: 550; font-size: .875rem; }
.btn-sm { font-size: .8rem; border-radius: 8px; }
.btn-primary { background: var(--agm-brand); border-color: var(--agm-brand); }
.btn-primary:hover { background: var(--agm-brand-600); border-color: var(--agm-brand-600); }

.nav-tabs { border-bottom: 1px solid var(--agm-border); gap: .15rem; }
.nav-tabs .nav-link {
  border: none; border-bottom: 2px solid transparent; color: var(--agm-muted);
  font-size: .875rem; font-weight: 600; padding: .55rem .9rem;
}
.nav-tabs .nav-link.active { color: var(--agm-brand); border-bottom-color: var(--agm-brand); background: transparent; }

.badge-soft {
  background: var(--agm-brand-050); color: var(--agm-brand-600);
  font-weight: 650; font-size: .7rem; padding: .25rem .5rem; border-radius: 6px;
}

.list-tight > .list-group-item { padding: .6rem .85rem; border-color: var(--agm-border); background: transparent; }

/* Page de connexion */
.login-page {
  min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(1200px 600px at 15% 10%, #1e3a8a 0%, transparent 55%),
              radial-gradient(900px 500px at 85% 90%, #4c1d95 0%, transparent 55%), #0b1120;
  padding: 1.5rem;
}
.login-card {
  width: 100%; max-width: 420px; background: #fff;
  border-radius: 18px; padding: 2.1rem; box-shadow: 0 24px 60px rgba(2, 6, 23, .45);
}
.login-brand { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.6rem; }
.login-brand .brand-mark {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  display: grid; place-items: center; color: #fff; font-size: 1.25rem;
}

/* Impression */
@media print {
  .app-sidebar, .app-topbar, .app-footer, .no-print { display: none !important; }
  .app-main { margin-left: 0; }
  .card { break-inside: avoid; box-shadow: none; }
  body { background: #fff; }
}

/* --------------------------------------------------------------------------
   Pages publiques : accueil, confidentialité, conditions, mentions légales.
   Accessibles sans connexion, elles servent aussi à la validation de
   l'application par Google (écran de consentement OAuth).
   -------------------------------------------------------------------------- */

.public-page {
  background: var(--agm-bg); color: var(--agm-text);
  display: flex; flex-direction: column; min-height: 100vh;
}
.public-wrap { width: 100%; max-width: 900px; margin: 0 auto; padding: 0 1.15rem; }

.public-header {
  background: var(--agm-surface); border-bottom: 1px solid var(--agm-border);
  padding: .8rem 0; position: sticky; top: 0; z-index: 10;
}
.public-brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: inherit; }
.public-brand-name { display: block; font-weight: 700; font-size: .98rem; line-height: 1.2; }
.public-brand-sub  { display: block; font-size: .74rem; color: var(--agm-muted); }

.public-nav { gap: .25rem; }
.public-nav a {
  color: var(--agm-muted); text-decoration: none; font-size: .84rem; font-weight: 550;
  padding: .35rem .65rem; border-radius: 8px;
}
.public-nav a:hover      { color: var(--agm-text); background: var(--agm-bg); }
.public-nav a.is-current { color: var(--agm-brand); background: var(--agm-brand-050); }

.public-main { flex: 1; padding-top: 2.4rem; padding-bottom: 3rem; }

.public-h1   { font-size: 1.75rem; font-weight: 700; line-height: 1.25; margin: 0 0 .7rem; }
.public-lead { font-size: 1.02rem; line-height: 1.65; color: var(--agm-muted); margin: 0 0 .5rem; }

/* Corps des textes juridiques : lecture longue, on aère sans excès */
.public-doc h2 {
  font-size: 1.12rem; font-weight: 680; margin: 2.1rem 0 .6rem;
  padding-top: 1.1rem; border-top: 1px solid var(--agm-border);
}
.public-doc h2:first-of-type { border-top: 0; padding-top: 0; margin-top: 1.4rem; }
.public-doc h3 { font-size: .95rem; font-weight: 650; margin: 1.3rem 0 .4rem; }
.public-doc p, .public-doc li { font-size: .92rem; line-height: 1.7; }
.public-doc p  { margin: 0 0 .75rem; }
.public-doc ul, .public-doc ol { margin: 0 0 .9rem; padding-left: 1.2rem; }
.public-doc li { margin-bottom: .3rem; }
.public-doc table { width: 100%; font-size: .88rem; margin: 0 0 1rem; }
.public-doc th { text-align: left; font-weight: 650; }
.public-doc a { color: var(--agm-brand); }

.legal-todo {
  background: #fef3c7; color: #92400e; padding: .05rem .35rem;
  border-radius: 5px; font-size: .85em; font-weight: 600;
}
[data-bs-theme="dark"] .legal-todo { background: #422006; color: #fcd34d; }

.public-callout {
  border: 1px solid var(--agm-border); border-left: 3px solid var(--agm-brand);
  background: var(--agm-surface); border-radius: 10px; padding: .9rem 1rem;
  margin: 0 0 1.2rem;
}
.public-callout p:last-child { margin-bottom: 0; }

/* Accueil */
.public-hero { padding: 1rem 0 2rem; }
.public-hero h1 { font-size: 2.1rem; font-weight: 720; line-height: 1.18; margin: 0 0 .9rem; }
.public-hero .public-lead { font-size: 1.08rem; max-width: 46rem; }

.public-features { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.public-feature {
  background: var(--agm-surface); border: 1px solid var(--agm-border);
  border-radius: var(--agm-radius); padding: 1.05rem;
}
.public-feature i { font-size: 1.3rem; color: var(--agm-brand); display: block; margin-bottom: .5rem; }
.public-feature h3 { font-size: .95rem; font-weight: 650; margin: 0 0 .3rem; }
.public-feature p  { font-size: .855rem; line-height: 1.6; color: var(--agm-muted); margin: 0; }

.public-footer {
  background: var(--agm-surface); border-top: 1px solid var(--agm-border);
  padding: 1.3rem 0; margin-top: auto;
}
.public-footer-nav { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: .6rem; }
.public-footer-nav a { color: var(--agm-muted); text-decoration: none; font-size: .82rem; }
.public-footer-nav a:hover      { color: var(--agm-text); }
.public-footer-nav a.is-current { color: var(--agm-brand); }

@media (max-width: 575.98px) {
  .public-h1 { font-size: 1.45rem; }
  .public-hero h1 { font-size: 1.65rem; }
}
