/* ═══════════════════════════════════════════════════════════════════════
   CAMALARM CRM — AGENDA T203 STYLE
   ═══════════════════════════════════════════════════════════════════════
   Référence : Linear / Notion / Webflow dashboard
   Scope : #tab-agenda-scope (n'affecte pas le reste du CRM)
   Cohérent avec le Cockpit V2 (variables --cp-*)
   ═══════════════════════════════════════════════════════════════════════ */

#tab-agenda-scope {
  --ag-orange: #E65100;
  --ag-orange-soft: #FFF3E0;
  --ag-orange-border: #FFCC80;
  --ag-blue: #1565C0;
  --ag-blue-soft: #EFF6FF;
  --ag-text: #0F172A;
  --ag-text-2: #475569;
  --ag-text-3: #64748B;
  --ag-text-muted: #94A3B8;
  --ag-bg: #F8FAFC;
  --ag-card: #FFFFFF;
  --ag-card-soft: #FAFBFD;
  --ag-border: #E5E7EB;
  --ag-border-soft: #F1F5F9;
  --ag-success: #10B981;
  --ag-success-soft: #ECFDF5;
  --ag-success-text: #065F46;
  --ag-danger: #EF4444;
  --ag-danger-soft: #FEF2F2;
  --ag-danger-text: #991B1B;
  --ag-info: #3B82F6;
  --ag-info-soft: #EFF6FF;
  --ag-info-text: #1E40AF;
  --ag-purple: #8B5CF6;
  --ag-purple-soft: #F5F3FF;
  --ag-purple-text: #5B21B6;
  --ag-radius: 12px;
  --ag-radius-sm: 8px;
  --ag-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  --ag-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.08);
  --ag-gap: 16px;

  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ag-text);
}

#tab-agenda-scope * { box-sizing: border-box; }

/* ═══ HEADER ════════════════════════════════════════════════════════ */
#tab-agenda-scope .ag-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--ag-gap);
  flex-wrap: wrap;
  gap: 12px;
}
#tab-agenda-scope .ag-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--ag-text);
  letter-spacing: -0.02em;
  margin: 0;
}
#tab-agenda-scope .ag-subtitle {
  font-size: 13px;
  color: var(--ag-text-3);
  margin: 4px 0 0 0;
}
#tab-agenda-scope .ag-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ═══ BOUTONS ═══════════════════════════════════════════════════════ */
#tab-agenda-scope .ag-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  border: 1px solid var(--ag-border);
  background: var(--ag-card);
  color: var(--ag-text-2);
  border-radius: var(--ag-radius-sm);
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}
#tab-agenda-scope .ag-btn:hover {
  background: var(--ag-card-soft);
  border-color: var(--ag-text-muted);
  color: var(--ag-text);
}
#tab-agenda-scope .ag-btn-accent {
  background: var(--ag-orange);
  color: #fff;
  border-color: var(--ag-orange);
}
#tab-agenda-scope .ag-btn-accent:hover {
  background: #C44400;
  border-color: #C44400;
}
#tab-agenda-scope .ag-btn-ghost {
  background: transparent;
}
#tab-agenda-scope .ag-btn-danger {
  background: var(--ag-danger-soft);
  border-color: #FECACA;
  color: var(--ag-danger-text);
}
#tab-agenda-scope .ag-btn-danger:hover {
  background: var(--ag-danger);
  color: #fff;
  border-color: var(--ag-danger);
}
#tab-agenda-scope .ag-btn-sm {
  padding: 6px 10px;
  font-size: 12px;
}
#tab-agenda-scope .ag-btn svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}

/* ═══ KPI GRID ══════════════════════════════════════════════════════ */
#tab-agenda-scope .ag-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--ag-gap);
  margin-bottom: var(--ag-gap);
}
#tab-agenda-scope .ag-kpi {
  background: var(--ag-card);
  border: 1px solid var(--ag-border);
  border-top: 2px solid var(--ag-orange);
  border-radius: var(--ag-radius);
  padding: 16px 18px;
  cursor: pointer;
  transition: all .15s ease;
  box-shadow: var(--ag-shadow);
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
}
#tab-agenda-scope .ag-kpi:hover {
  border-color: var(--ag-text-muted);
  border-top-color: #FF7A33;
  box-shadow: var(--ag-shadow-hover);
}
#tab-agenda-scope .ag-kpi-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ag-text-3);
  text-transform: none;
  letter-spacing: 0;
}
#tab-agenda-scope .ag-kpi-value {
  font-family: 'JetBrains Mono', 'Menlo', monospace;
  font-size: 26px;
  font-weight: 700;
  color: var(--ag-text);
  letter-spacing: -0.02em;
  line-height: 1;
}
#tab-agenda-scope .ag-kpi-foot {
  font-size: 11px;
  color: var(--ag-text-muted);
}

/* ═══ FILTRES ══════════════════════════════════════════════════════ */
#tab-agenda-scope .ag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  background: var(--ag-card);
  border: 1px solid var(--ag-border);
  border-radius: var(--ag-radius);
  padding: 12px 14px;
  margin-bottom: var(--ag-gap);
  box-shadow: var(--ag-shadow);
}
#tab-agenda-scope .ag-search {
  flex: 1;
  min-width: 240px;
  position: relative;
}
#tab-agenda-scope .ag-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--ag-text-muted);
  pointer-events: none;
}
#tab-agenda-scope .ag-search input {
  width: 100%;
  padding: 8px 10px 8px 32px;
  border: 1px solid var(--ag-border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: var(--ag-card-soft);
  color: var(--ag-text);
  transition: border-color .15s ease;
}
#tab-agenda-scope .ag-search input:focus {
  outline: 0;
  border-color: var(--ag-orange);
  background: var(--ag-card);
  box-shadow: 0 0 0 3px rgba(230, 81, 0, 0.08);
}
#tab-agenda-scope .ag-filter-select,
#tab-agenda-scope .ag-filter-input {
  padding: 8px 10px;
  border: 1px solid var(--ag-border);
  border-radius: 6px;
  font-size: 12.5px;
  font-family: inherit;
  background: var(--ag-card);
  color: var(--ag-text);
  min-width: 130px;
  cursor: pointer;
  transition: border-color .15s ease;
}
#tab-agenda-scope .ag-filter-select:focus,
#tab-agenda-scope .ag-filter-input:focus {
  outline: 0;
  border-color: var(--ag-orange);
}

/* ═══ TABS DE VUE ═══════════════════════════════════════════════════ */
#tab-agenda-scope .ag-view-tabs {
  display: inline-flex;
  background: var(--ag-card);
  border: 1px solid var(--ag-border);
  border-radius: var(--ag-radius-sm);
  padding: 4px;
  margin-bottom: var(--ag-gap);
  gap: 2px;
}
#tab-agenda-scope .ag-view-tab {
  padding: 6px 16px;
  font-size: 12.5px;
  font-weight: 500;
  background: transparent;
  border: none;
  color: var(--ag-text-3);
  border-radius: 6px;
  cursor: pointer;
  transition: all .12s ease;
  font-family: 'Inter', sans-serif;
}
#tab-agenda-scope .ag-view-tab:hover {
  color: var(--ag-text);
  background: var(--ag-card-soft);
}
#tab-agenda-scope .ag-view-tab.is-active {
  background: var(--ag-orange-soft);
  color: var(--ag-orange);
  font-weight: 600;
}

/* ═══ VUE HOST ══════════════════════════════════════════════════════ */
#tab-agenda-scope .ag-view-host {
  background: var(--ag-card);
  border: 1px solid var(--ag-border);
  border-radius: var(--ag-radius);
  box-shadow: var(--ag-shadow);
  overflow: hidden;
  min-height: 300px;
}
#tab-agenda-scope .ag-view-loading,
#tab-agenda-scope .ag-view-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--ag-text-muted);
  font-size: 13px;
}
#tab-agenda-scope .ag-view-empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ag-text-2);
  margin-bottom: 6px;
}

/* ═══ VUE LISTE — Day groups (épurée premium) ═══════════════════════ */
#tab-agenda-scope .ag-day-group {
  border-bottom: none;
}
#tab-agenda-scope .ag-day-group + .ag-day-group {
  margin-top: 8px;
}
#tab-agenda-scope .ag-day-header {
  position: sticky;
  top: 0;
  background: linear-gradient(to bottom, var(--ag-card) 0%, var(--ag-card) 60%, rgba(255,255,255,0.85) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 14px 24px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 1;
  border-bottom: 1px solid var(--ag-border-soft);
}
#tab-agenda-scope .ag-day-header.is-today {
  background: linear-gradient(to bottom, var(--ag-orange-soft) 0%, rgba(255, 243, 224, 0.6) 100%);
  border-bottom-color: var(--ag-orange-border);
}
#tab-agenda-scope .ag-day-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--ag-text);
  letter-spacing: -0.01em;
}
#tab-agenda-scope .ag-day-header.is-today .ag-day-date {
  color: var(--ag-orange);
}
#tab-agenda-scope .ag-day-label {
  font-size: 11px;
  color: var(--ag-text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
#tab-agenda-scope .ag-day-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 500;
  color: var(--ag-text-muted);
  padding: 2px 8px;
  background: var(--ag-card-soft);
  border-radius: 9999px;
}
#tab-agenda-scope .ag-day-header.is-today .ag-day-count {
  background: rgba(255, 255, 255, 0.6);
  color: var(--ag-orange);
}

/* ═══ Item RDV (Liste épurée — séparateur subtil + hover élégant) ══ */
#tab-agenda-scope .ag-event-item {
  position: relative;
  display: grid;
  grid-template-columns: 4px 76px 1fr auto;
  gap: 14px;
  padding: 16px 20px 16px 16px;
  cursor: pointer;
  transition: background 0.12s ease, box-shadow 0.12s ease;
  align-items: flex-start;
  border-bottom: 1px solid var(--ag-border-soft);
}
#tab-agenda-scope .ag-day-group .ag-event-item:last-child {
  border-bottom: none;
}
#tab-agenda-scope .ag-event-item:hover {
  background: var(--ag-card-soft);
}
#tab-agenda-scope .ag-event-item:focus-visible {
  outline: 0;
  background: var(--ag-card-soft);
  box-shadow: inset 0 0 0 2px var(--ag-orange);
}

/* Indicateur type couleur à gauche (barre verticale élégante) */
#tab-agenda-scope .ag-event-stripe {
  width: 4px;
  align-self: stretch;
  border-radius: 2px;
  background: var(--ag-text-muted);
  flex-shrink: 0;
}
#tab-agenda-scope .ag-event-stripe.is-installation     { background: var(--ag-info); }
#tab-agenda-scope .ag-event-stripe.is-visite_technique { background: var(--ag-orange); }
#tab-agenda-scope .ag-event-stripe.is-devis            { background: var(--ag-orange); }
#tab-agenda-scope .ag-event-stripe.is-maintenance      { background: var(--ag-success); }
#tab-agenda-scope .ag-event-stripe.is-entretien        { background: var(--ag-success); }
#tab-agenda-scope .ag-event-stripe.is-depannage        { background: var(--ag-danger); }
#tab-agenda-scope .ag-event-stripe.is-controle         { background: var(--ag-info); }
#tab-agenda-scope .ag-event-stripe.is-suivi_commercial { background: var(--ag-purple); }
#tab-agenda-scope .ag-event-stripe.is-administratif    { background: var(--ag-text-3); }

#tab-agenda-scope .ag-event-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--ag-text);
  padding-top: 2px;
  letter-spacing: -0.01em;
}
#tab-agenda-scope .ag-event-time-end {
  display: block;
  font-size: 11px;
  color: var(--ag-text-muted);
  font-weight: 400;
  margin-top: 2px;
}
#tab-agenda-scope .ag-event-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#tab-agenda-scope .ag-event-row1 {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
#tab-agenda-scope .ag-event-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ag-text);
  letter-spacing: -0.005em;
}
#tab-agenda-scope .ag-event-row2 {
  font-size: 12px;
  color: var(--ag-text-3);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
#tab-agenda-scope .ag-event-row2 svg {
  width: 12px;
  height: 12px;
  stroke-width: 1.75;
  color: var(--ag-text-muted);
  margin-right: 3px;
  vertical-align: -2px;
}
#tab-agenda-scope .ag-event-row3 {
  font-size: 11.5px;
  color: var(--ag-text-3);
}
#tab-agenda-scope .ag-event-alerts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Actions à droite : TOUJOURS visibles, alignées, propres */
#tab-agenda-scope .ag-event-actions {
  display: inline-flex;
  gap: 4px;
  flex-shrink: 0;
  align-items: center;
  padding-top: 2px;
}
#tab-agenda-scope .ag-icon-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ag-text-3);
  cursor: pointer;
  transition: all 0.12s ease;
  position: relative;
}
#tab-agenda-scope .ag-icon-btn:hover {
  background: var(--ag-card);
  border-color: var(--ag-border);
  color: var(--ag-text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
#tab-agenda-scope .ag-icon-btn:focus-visible {
  outline: 2px solid var(--ag-orange);
  outline-offset: 1px;
}
#tab-agenda-scope .ag-icon-btn.is-accent:hover {
  background: var(--ag-orange-soft);
  border-color: var(--ag-orange-border);
  color: var(--ag-orange);
}
#tab-agenda-scope .ag-icon-btn.is-success:hover {
  background: var(--ag-success-soft);
  border-color: #A7F3D0;
  color: var(--ag-success-text);
}
#tab-agenda-scope .ag-icon-btn.is-danger:hover {
  background: var(--ag-danger-soft);
  border-color: #FECACA;
  color: var(--ag-danger-text);
}
#tab-agenda-scope .ag-icon-btn svg {
  width: 15px;
  height: 15px;
  stroke-width: 1.75;
}

/* Tooltip natif amélioré (utilise title=, donc juste un soin visuel discret) */
#tab-agenda-scope .ag-icon-btn[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 10.5px;
  font-weight: 500;
  padding: 4px 8px;
  background: var(--ag-text);
  color: #FFFFFF;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
  letter-spacing: 0;
}

/* ═══ TYPES (badges) ══════════════════════════════════════════════ */
#tab-agenda-scope .ag-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 10.5px;
  font-weight: 600;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
#tab-agenda-scope .ag-type-badge.is-installation     { background: var(--ag-blue-soft); color: var(--ag-info-text); }
#tab-agenda-scope .ag-type-badge.is-visite_technique { background: var(--ag-orange-soft); color: var(--ag-orange); }
#tab-agenda-scope .ag-type-badge.is-maintenance      { background: var(--ag-success-soft); color: var(--ag-success-text); }
#tab-agenda-scope .ag-type-badge.is-depannage        { background: var(--ag-danger-soft); color: var(--ag-danger-text); }
#tab-agenda-scope .ag-type-badge.is-suivi_commercial { background: var(--ag-purple-soft); color: var(--ag-purple-text); }
#tab-agenda-scope .ag-type-badge.is-administratif    { background: var(--ag-border-soft); color: var(--ag-text-2); }

/* ═══ STATUTS (badges) ════════════════════════════════════════════ */
#tab-agenda-scope .ag-status-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
#tab-agenda-scope .ag-status-badge.is-a_planifier       { background: var(--ag-border-soft); color: var(--ag-text-3); }
#tab-agenda-scope .ag-status-badge.is-planifie          { background: var(--ag-info-soft); color: var(--ag-info-text); }
#tab-agenda-scope .ag-status-badge.is-a_confirmer       { background: var(--ag-orange-soft); color: var(--ag-orange); }
#tab-agenda-scope .ag-status-badge.is-confirme          { background: var(--ag-success-soft); color: var(--ag-success-text); }
#tab-agenda-scope .ag-status-badge.is-en_attente_client { background: #E0E7FF; color: #3730A3; }
#tab-agenda-scope .ag-status-badge.is-en_cours          { background: var(--ag-purple-soft); color: var(--ag-purple-text); }
#tab-agenda-scope .ag-status-badge.is-termine           { background: #D1FAE5; color: #064E3B; }
#tab-agenda-scope .ag-status-badge.is-reporte           { background: var(--ag-border-soft); color: var(--ag-text-2); }
#tab-agenda-scope .ag-status-badge.is-annule            { background: var(--ag-danger-soft); color: var(--ag-danger-text); }

/* ═══ ALERTES (acompte / matériel / Peppol) ═══════════════════════ */
#tab-agenda-scope .ag-alert-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 500;
  border-radius: 4px;
  white-space: nowrap;
}
#tab-agenda-scope .ag-alert-tag.is-warn  { background: var(--ag-orange-soft); color: var(--ag-orange); }
#tab-agenda-scope .ag-alert-tag.is-info  { background: var(--ag-info-soft); color: var(--ag-info-text); }
#tab-agenda-scope .ag-alert-tag.is-purple{ background: var(--ag-purple-soft); color: var(--ag-purple-text); }
#tab-agenda-scope .ag-alert-tag svg {
  width: 10px;
  height: 10px;
  stroke-width: 2;
}

/* ═══ VUE SEMAINE (liste verticale par jour — mobile-friendly T203C) ═══ */
#tab-agenda-scope .ag-week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--ag-border-soft);
  background: var(--ag-card);
  position: sticky;
  top: 0;
  z-index: 2;
}
#tab-agenda-scope .ag-week-nav-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ag-text);
  letter-spacing: -0.01em;
}
#tab-agenda-scope .ag-week-nav-count {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ag-text-3);
  padding: 3px 10px;
  background: var(--ag-card-soft);
  border-radius: 9999px;
}
#tab-agenda-scope .ag-week-list {
  display: flex;
  flex-direction: column;
}
#tab-agenda-scope .ag-wlist-day {
  border-bottom: 1px solid var(--ag-border-soft);
}
#tab-agenda-scope .ag-wlist-day:last-child {
  border-bottom: none;
}
#tab-agenda-scope .ag-wlist-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--ag-card-soft);
  border-bottom: 1px solid var(--ag-border-soft);
  cursor: pointer;
  transition: background 0.12s ease;
}
#tab-agenda-scope .ag-wlist-day-header:hover {
  background: #F1F5F9;
}
#tab-agenda-scope .ag-wlist-day.is-today .ag-wlist-day-header {
  background: var(--ag-orange-soft);
  border-bottom-color: var(--ag-orange-border);
}
#tab-agenda-scope .ag-wlist-day-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
#tab-agenda-scope .ag-wlist-day-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ag-text);
  letter-spacing: -0.01em;
}
#tab-agenda-scope .ag-wlist-day.is-today .ag-wlist-day-name {
  color: var(--ag-orange);
}
#tab-agenda-scope .ag-wlist-day-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--ag-text-3);
}
#tab-agenda-scope .ag-wlist-today-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #FFFFFF;
  background: var(--ag-orange);
  padding: 2px 8px;
  border-radius: 9999px;
}
#tab-agenda-scope .ag-wlist-day-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}
#tab-agenda-scope .ag-wlist-day-count {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ag-text-3);
  padding: 2px 10px;
  background: var(--ag-card);
  border-radius: 9999px;
}
#tab-agenda-scope .ag-wlist-day-empty {
  font-size: 11.5px;
  color: var(--ag-text-muted);
  font-style: italic;
}
#tab-agenda-scope .ag-wlist-add-btn {
  font-size: 16px;
  line-height: 1;
  font-weight: 400;
  color: var(--ag-orange);
}
#tab-agenda-scope .ag-wlist-add-btn:hover {
  background: var(--ag-orange-soft);
  border-color: var(--ag-orange-border);
}
#tab-agenda-scope .ag-wlist-events {
  background: var(--ag-card);
}

@media (max-width: 768px) {
  #tab-agenda-scope .ag-wlist-day-header { padding: 10px 14px; }
  #tab-agenda-scope .ag-wlist-day-info { gap: 8px; }
  #tab-agenda-scope .ag-wlist-day-name { font-size: 12.5px; }
}

/* ═══ VUE MOIS ═══════════════════════════════════════════════════ */
#tab-agenda-scope .ag-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
}
#tab-agenda-scope .ag-month-day-name {
  text-align: center;
  padding: 8px 4px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ag-text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--ag-card-soft);
  border-bottom: 1px solid var(--ag-border-soft);
}
#tab-agenda-scope .ag-month-cell {
  min-height: 88px;
  border-right: 1px solid var(--ag-border-soft);
  border-bottom: 1px solid var(--ag-border-soft);
  padding: 6px 8px;
  cursor: pointer;
  transition: background .12s ease;
}
#tab-agenda-scope .ag-month-cell:nth-child(7n) { border-right: none; }
#tab-agenda-scope .ag-month-cell:hover {
  background: var(--ag-card-soft);
}
#tab-agenda-scope .ag-month-cell.is-today {
  background: var(--ag-orange-soft);
}
#tab-agenda-scope .ag-month-cell.is-other-month {
  background: var(--ag-card-soft);
  opacity: 0.55;
}
#tab-agenda-scope .ag-month-day-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--ag-text);
  margin-bottom: 4px;
}
#tab-agenda-scope .ag-month-cell.is-today .ag-month-day-num {
  color: var(--ag-orange);
}
#tab-agenda-scope .ag-month-events {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
#tab-agenda-scope .ag-month-event {
  font-size: 9.5px;
  font-weight: 500;
  padding: 1px 4px;
  border-radius: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
#tab-agenda-scope .ag-month-event.is-blue   { background: var(--ag-info); color: #fff; }
#tab-agenda-scope .ag-month-event.is-orange { background: var(--ag-orange); color: #fff; }
#tab-agenda-scope .ag-month-event.is-green  { background: var(--ag-success); color: #fff; }
#tab-agenda-scope .ag-month-event.is-red    { background: var(--ag-danger); color: #fff; }
#tab-agenda-scope .ag-month-event.is-purple { background: var(--ag-purple); color: #fff; }
#tab-agenda-scope .ag-month-event.is-gray   { background: var(--ag-text-3); color: #fff; }
#tab-agenda-scope .ag-month-event-more {
  font-size: 9.5px;
  color: var(--ag-orange);
  font-weight: 600;
  cursor: pointer;
  margin-top: 2px;
}
#tab-agenda-scope .ag-month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ag-border-soft);
}

/* ═══════════════════════════════════════════════════════════════════════
   MODALE V2 — premium, scope .ag-mv2-*, ZÉRO classe legacy
   ═══════════════════════════════════════════════════════════════════════ */

/* Variables locales (alignées sur agenda) */
.ag-mv2-overlay {
  --mv-orange: #E65100;
  --mv-orange-soft: #FFF3E0;
  --mv-text: #0F172A;
  --mv-text-2: #475569;
  --mv-text-3: #64748B;
  --mv-text-muted: #94A3B8;
  --mv-bg: #F8FAFC;
  --mv-card: #FFFFFF;
  --mv-card-soft: #FAFBFD;
  --mv-border: #E5E7EB;
  --mv-border-soft: #F1F5F9;
  --mv-success: #10B981;
  --mv-success-soft: #ECFDF5;
  --mv-success-text: #065F46;
  --mv-danger: #EF4444;
  --mv-danger-soft: #FEF2F2;
  --mv-danger-text: #991B1B;
  --mv-info-soft: #EFF6FF;
  --mv-info-text: #1E40AF;

  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--mv-text);
}
.ag-mv2-overlay.is-open {
  display: flex;
  animation: agMV2-fade-in 0.12s ease;
}
@keyframes agMV2-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ag-mv2-dialog {
  background: var(--mv-card);
  border-radius: 16px;
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.04),
    0 24px 64px rgba(15, 23, 42, 0.16),
    0 8px 24px rgba(15, 23, 42, 0.08);
  width: 100%;
  max-width: 720px;
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: agMV2-slide-up 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}
.ag-mv2-dialog-sm { max-width: 440px; }
@keyframes agMV2-slide-up {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* Header */
.ag-mv2-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--mv-border-soft);
}
.ag-mv2-head-text { flex: 1; min-width: 0; }
.ag-mv2-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--mv-text);
  line-height: 1.3;
}
.ag-mv2-subtitle {
  font-size: 13px;
  color: var(--mv-text-3);
  margin-top: 4px;
  line-height: 1.4;
}
.ag-mv2-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--mv-text-3);
  cursor: pointer;
  transition: all 0.15s ease;
}
.ag-mv2-close:hover {
  background: var(--mv-border-soft);
  color: var(--mv-text);
}
.ag-mv2-close:focus-visible {
  outline: 2px solid var(--mv-orange);
  outline-offset: 2px;
}
.ag-mv2-close svg { width: 16px; height: 16px; }

/* Sync bar (Google Calendar) */
.ag-mv2-syncbar {
  padding: 10px 24px;
  background: var(--mv-info-soft);
  border-bottom: 1px solid var(--mv-border-soft);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}
.ag-mv2-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 10.5px;
  font-weight: 600;
  background: var(--mv-card);
  color: var(--mv-text-2);
  border: 1px solid var(--mv-border);
}
.ag-mv2-sync-badge.is-synced {
  background: var(--mv-success-soft);
  color: var(--mv-success-text);
  border-color: #A7F3D0;
}
.ag-mv2-sync-badge.is-pending {
  background: var(--mv-orange-soft);
  color: var(--mv-orange);
  border-color: #FFCC80;
}
.ag-mv2-sync-badge.is-error {
  background: var(--mv-danger-soft);
  color: var(--mv-danger-text);
  border-color: #FECACA;
}
.ag-mv2-sync-info { color: var(--mv-text-3); }

/* Body */
.ag-mv2-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  background: var(--mv-card);
}

/* Sections */
.ag-mv2-section {
  margin-bottom: 24px;
}
.ag-mv2-section:last-child { margin-bottom: 0; }
.ag-mv2-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--mv-text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--mv-border-soft);
}

/* Grid form */
.ag-mv2-grid {
  display: grid;
  gap: 14px;
}
.ag-mv2-grid.ag-mv2-cols-1 { grid-template-columns: 1fr; }
.ag-mv2-grid.ag-mv2-cols-2 { grid-template-columns: 1fr 1fr; }
.ag-mv2-col-span { grid-column: 1 / -1; }

/* Field */
.ag-mv2-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ag-mv2-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--mv-text-3);
  letter-spacing: 0.005em;
}

/* Inputs premium (zéro look système) */
.ag-mv2-input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  color: var(--mv-text);
  background: var(--mv-card);
  border: 1px solid var(--mv-border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
  -webkit-appearance: none;
  appearance: none;
}
.ag-mv2-input::placeholder { color: var(--mv-text-muted); }
.ag-mv2-input:hover { border-color: #CBD5E1; }
.ag-mv2-input:focus {
  border-color: var(--mv-orange);
  box-shadow: 0 0 0 3px rgba(230, 81, 0, 0.10);
}
.ag-mv2-textarea {
  height: auto;
  min-height: 64px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.5;
}
/* Custom select chevron (zéro look natif) */
select.ag-mv2-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

/* Date/time inputs : neutralise look natif */
input.ag-mv2-input[type="date"],
input.ag-mv2-input[type="time"] {
  font-family: 'JetBrains Mono', 'Menlo', monospace;
  font-size: 13px;
}
input.ag-mv2-input[type="date"]::-webkit-calendar-picker-indicator,
input.ag-mv2-input[type="time"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.12s ease;
}
input.ag-mv2-input[type="date"]:hover::-webkit-calendar-picker-indicator,
input.ag-mv2-input[type="time"]:hover::-webkit-calendar-picker-indicator {
  opacity: 1;
}

/* Checkboxes premium */
.ag-mv2-checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}
.ag-mv2-checkbox-field {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--mv-text);
  cursor: pointer;
  user-select: none;
  padding: 6px 0;
}
.ag-mv2-checkbox-field input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--mv-orange);
  cursor: pointer;
  margin: 0;
  flex-shrink: 0;
}

/* Footer — boutons premium hiérarchisés */
.ag-mv2-foot {
  padding: 14px 24px;
  border-top: 1px solid var(--mv-border-soft);
  background: var(--mv-card-soft);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ag-mv2-foot-spacer { flex: 1; min-width: 8px; }

.ag-mv2-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.12s ease;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
.ag-mv2-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.ag-mv2-btn:focus-visible {
  outline: 2px solid var(--mv-orange);
  outline-offset: 2px;
}

.ag-mv2-btn-ghost {
  background: transparent;
  color: var(--mv-text-2);
  border-color: var(--mv-border);
}
.ag-mv2-btn-ghost:hover {
  background: var(--mv-card);
  color: var(--mv-text);
  border-color: #CBD5E1;
}

.ag-mv2-btn-secondary {
  background: var(--mv-card);
  color: var(--mv-text-2);
  border-color: var(--mv-border);
}
.ag-mv2-btn-secondary:hover {
  background: var(--mv-card-soft);
  color: var(--mv-text);
  border-color: var(--mv-text-muted);
}

.ag-mv2-btn-primary {
  background: var(--mv-orange);
  color: #FFFFFF;
  border-color: var(--mv-orange);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(230, 81, 0, 0.20);
}
.ag-mv2-btn-primary:hover {
  background: #C44400;
  border-color: #C44400;
  box-shadow: 0 4px 12px rgba(230, 81, 0, 0.25);
}
.ag-mv2-btn-primary:active { transform: translateY(1px); }

.ag-mv2-btn-danger {
  background: var(--mv-card);
  color: var(--mv-danger-text);
  border-color: #FECACA;
}
.ag-mv2-btn-danger:hover {
  background: var(--mv-danger);
  color: #FFFFFF;
  border-color: var(--mv-danger);
}

/* Confirmation modale (suppression) */
.ag-mv2-confirm {
  padding: 28px 24px 20px;
  text-align: center;
}
.ag-mv2-confirm-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--mv-danger-soft);
  color: var(--mv-danger);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.ag-mv2-confirm-icon svg {
  width: 26px;
  height: 26px;
}
.ag-mv2-confirm-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--mv-text);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.ag-mv2-confirm-text {
  font-size: 13px;
  color: var(--mv-text-3);
  line-height: 1.5;
  margin-bottom: 20px;
}
.ag-mv2-confirm-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* Mobile modale */
@media (max-width: 768px) {
  .ag-mv2-overlay { padding: 0; align-items: stretch; }
  .ag-mv2-dialog {
    max-width: none;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }
  .ag-mv2-grid.ag-mv2-cols-2 { grid-template-columns: 1fr; }
  .ag-mv2-checks { grid-template-columns: 1fr; }
  .ag-mv2-foot { flex-wrap: wrap; }
  .ag-mv2-btn { flex: 1 1 auto; justify-content: center; }
  .ag-mv2-foot-spacer { display: none; }
}

/* ═══════════════════════════════════════════════════════════════════
   MENU KEBAB "⋯" sur item liste (Supprimer + actions secondaires)
   ═══════════════════════════════════════════════════════════════════ */
#tab-agenda-scope .ag-kebab-wrapper {
  position: relative;
  display: inline-flex;
}
#tab-agenda-scope .ag-kebab-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  background: var(--ag-card);
  border: 1px solid var(--ag-border);
  border-radius: 10px;
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.04),
    0 12px 32px rgba(15, 23, 42, 0.12);
  padding: 6px;
  z-index: 50;
  display: none;
  animation: agKebab-fade 0.12s ease;
}
@keyframes agKebab-fade {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}
#tab-agenda-scope .ag-kebab-menu.is-open { display: block; }
#tab-agenda-scope .ag-kebab-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ag-text);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s ease;
  text-align: left;
}
#tab-agenda-scope .ag-kebab-item:hover {
  background: var(--ag-card-soft);
}
#tab-agenda-scope .ag-kebab-item.is-danger {
  color: var(--ag-danger-text);
}
#tab-agenda-scope .ag-kebab-item.is-danger:hover {
  background: var(--ag-danger-soft);
}
#tab-agenda-scope .ag-kebab-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  stroke-width: 1.75;
  color: var(--ag-text-3);
}
#tab-agenda-scope .ag-kebab-item.is-danger svg { color: var(--ag-danger); }
#tab-agenda-scope .ag-kebab-divider {
  height: 1px;
  margin: 4px 0;
  background: var(--ag-border-soft);
}

/* ═══ RESPONSIVE ═══════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  #tab-agenda-scope .ag-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  #tab-agenda-scope .ag-header { flex-direction: column; align-items: stretch; }
  #tab-agenda-scope .ag-event-item { grid-template-columns: 4px 1fr; gap: 10px; padding: 14px 14px 14px 12px; }
  #tab-agenda-scope .ag-event-time { display: none; }
  #tab-agenda-scope .ag-event-actions { flex-wrap: wrap; }
  #tab-agenda-scope .ag-month-cell { min-height: 60px; padding: 4px 5px; }
  #tab-agenda-scope .ag-month-event { font-size: 8.5px; }
}
@media (max-width: 480px) {
  #tab-agenda-scope .ag-kpi-grid { grid-template-columns: 1fr 1fr; }
}
