/* ==========================================================================
   NOTION-STYLE DESIGN SYSTEM & DETAIL VIEWS
   FleetSync / Igeo CRM
   ========================================================================== */

/* ── Notion Palette & Variables (Dark Mode Default) ── */
:root,
[data-theme="dark"],
html.dark {
  --notion-bg: #191919;
  --notion-surface: #202020;
  --notion-surface-hover: #262626;
  --notion-border: rgba(255, 255, 255, 0.08);
  --notion-border-subtle: rgba(255, 255, 255, 0.04);
  --notion-text: #e6e6e6;
  --notion-text-muted: #9b9a97;
  --notion-text-subtle: #73726e;
  --notion-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --notion-font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --notion-tag-gray-bg: rgba(155, 154, 151, 0.15);
  --notion-tag-gray-text: #9b9a97;
  --notion-tag-brown-bg: rgba(147, 114, 100, 0.2);
  --notion-tag-brown-text: #ba856f;
  --notion-tag-orange-bg: rgba(255, 138, 76, 0.18);
  --notion-tag-orange-text: #ff9b57;
  --notion-tag-yellow-bg: rgba(235, 196, 70, 0.18);
  --notion-tag-yellow-text: #f1c742;
  --notion-tag-green-bg: rgba(77, 171, 154, 0.18);
  --notion-tag-green-text: #52c41a;
  --notion-tag-blue-bg: rgba(82, 156, 202, 0.18);
  --notion-tag-blue-text: #58a6ff;
  --notion-tag-purple-bg: rgba(154, 109, 215, 0.18);
  --notion-tag-purple-text: #bc8cff;
  --notion-tag-pink-bg: rgba(226, 85, 161, 0.18);
  --notion-tag-pink-text: #f778ba;
  --notion-tag-red-bg: rgba(255, 115, 105, 0.18);
  --notion-tag-red-text: #ff7b72;
  --notion-accent: #58a6ff;
}

/* ── Light Mode Override ── */
[data-theme="light"],
html.light {
  --notion-bg: #ffffff;
  --notion-surface: #f8fafc;
  --notion-surface-hover: #f1f5f9;
  --notion-border: rgba(0, 0, 0, 0.08);
  --notion-border-subtle: rgba(0, 0, 0, 0.04);
  --notion-text: #0f172a;
  --notion-text-muted: #64748b;
  --notion-text-subtle: #94a3b8;
  --notion-tag-gray-bg: rgba(100, 116, 139, 0.12);
  --notion-tag-gray-text: #475569;
  --notion-tag-brown-bg: rgba(180, 83, 9, 0.12);
  --notion-tag-brown-text: #92400e;
  --notion-tag-orange-bg: rgba(234, 88, 12, 0.12);
  --notion-tag-orange-text: #c2410c;
  --notion-tag-yellow-bg: rgba(202, 138, 4, 0.15);
  --notion-tag-yellow-text: #a16207;
  --notion-tag-green-bg: rgba(22, 163, 74, 0.12);
  --notion-tag-green-text: #15803d;
  --notion-tag-blue-bg: rgba(2, 132, 199, 0.12);
  --notion-tag-blue-text: #0369a1;
  --notion-tag-purple-bg: rgba(147, 51, 234, 0.12);
  --notion-tag-purple-text: #7e22ce;
  --notion-tag-pink-bg: rgba(219, 39, 119, 0.12);
  --notion-tag-pink-text: #be185d;
  --notion-tag-red-bg: rgba(220, 38, 38, 0.12);
  --notion-tag-red-text: #b91c1c;
  --notion-accent: #2563eb;
}

/* ── Notion Page Shell ── */
.notion-page-container {
  font-family: var(--notion-font-sans);
  background: var(--notion-bg);
  color: var(--notion-text);
  min-height: 100%;
  padding-bottom: 5rem;
  transition: background-color 0.25s ease, color 0.2s ease;
}

/* ── Notion Cover Banner ── */
/* Conteneur positionné qui n'enveloppe QUE la bannière (+ la barre d'identité
   compacte du panneau latéral, voir openNotionSidePeek) — sert d'ancrage
   fiable pour le voile de sortie ci-dessous, indépendamment de la hauteur
   variable du bandeau d'actions qui suit. */
.notion-cover-wrap {
  position: relative;
  flex-shrink: 0;
}

/* Voile dégradé qui prolonge la bannière sur quelques pixels, plutôt qu'une
   coupure nette — masque la transition entre le fondu au noir de la
   bannière et le fond uni de la page qui suit. Retiré tant que la bannière
   est désactivée (UI._coversEnabled = false) ; à réactiver avec la
   bannière (voir .notion-cover-has-content::after si besoin). */
.notion-cover-wrap.notion-cover-has-content::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 28px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
  pointer-events: none;
}

.notion-cover {
  position: relative;
  width: 100%;
  height: 156px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 50%, #1e1b4b 100%);
  background-size: cover;
  background-position: center;
  overflow: hidden;
  transition: height 0.3s ease;
}

/* Motif filigrane "réseau" (points reliés par des lignes fines) — donne un
   aspect texturé SaaS/télécom plutôt qu'une bande de couleur plate. Peint
   avant ::after dans l'ordre du DOM, donc recouvert par le fondu ci-dessous. */
.notion-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 140 140'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.35' stroke-width='1'%3E%3Cline x1='20' y1='20' x2='90' y2='40'/%3E%3Cline x1='90' y1='40' x2='120' y2='110'/%3E%3Cline x1='20' y1='20' x2='50' y2='100'/%3E%3Cline x1='50' y1='100' x2='120' y2='110'/%3E%3Cline x1='90' y1='40' x2='50' y2='100'/%3E%3C/g%3E%3Cg fill='%23ffffff' fill-opacity='0.4'%3E%3Ccircle cx='20' cy='20' r='2'/%3E%3Ccircle cx='90' cy='40' r='2'/%3E%3Ccircle cx='50' cy='100' r='2'/%3E%3Ccircle cx='120' cy='110' r='2'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 140px 140px;
  mix-blend-mode: overlay;
  opacity: 0.5;
  pointer-events: none;
}

/* Fondu au noir renforcé, sur toute la hauteur — transforme la couleur plate
   de la palette (window.PAGE_STYLE_PALETTE, js/page_style.js) en un ton
   profond et lisible, sans toucher la teinte propre à chaque entité, et sert
   de socle de contraste au nom superposé (.notion-identity-bar). */
.notion-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.38) 35%, rgba(0, 0, 0, 0.68) 70%, rgba(0, 0, 0, 0.92) 100%);
  pointer-events: none;
}

.notion-cover-actions {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.notion-btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.notion-btn-ghost:hover {
  background: rgba(0, 0, 0, 0.7);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

/* ── Notion Page Body Content ── */
.notion-content-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
}

@media (min-width: 1280px) {
  .notion-content-wrapper {
    max-width: 1200px;
    padding: 0 2rem;
  }
}

/* ── Barre d'identité (avatar + nom) ──
   Bannière désactivée pour le moment (UI._coversEnabled = false) : la barre
   repasse en flux normal, juste sous le fil d'Ariane, avec les couleurs de
   texte habituelles du thème plutôt qu'en blanc superposé à une bannière.
   (La variante position:absolute superposée à la bannière est conservée en
   mémoire dans l'historique — à restaurer avec la bannière elle-même.) */
.notion-identity-bar {
  position: relative;
  margin: 0.5rem 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.notion-identity-bar.compact {
  margin: 1.25rem 1.5rem 1rem;
}

.notion-identity-bar .notion-title-section {
  margin-bottom: 0;
  min-width: 0;
}

.notion-identity-bar .notion-page-title {
  color: var(--notion-text);
}

.notion-identity-bar .notion-page-subtitle {
  color: var(--notion-text-muted);
}

.notion-identity-bar .notion-page-title.compact {
  font-size: 1.25rem;
}

.notion-page-icon {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 1.25rem;
  background: var(--notion-surface);
  border: 3px solid var(--notion-bg);
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--notion-text);
  font-size: 2.25rem;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.25s ease;
}

.notion-page-icon:hover {
  transform: scale(1.05);
}

/* Reflet lumineux pour donner du relief au badge d'avatar (le glyphe/initiales
   reçoit z-index:1 pour rester peint au-dessus du reflet, sinon un pseudo-
   élément positionné passe toujours devant un enfant statique en peinture CSS) */
.notion-page-icon::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 55%);
  pointer-events: none;
}

.notion-page-icon > * {
  position: relative;
  z-index: 1;
}

/* ── Notion Breadcrumbs & Top Toolbar ── */
.notion-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--notion-border-subtle);
}

.notion-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: var(--notion-text-muted);
}

.notion-breadcrumb-item {
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 0.375rem;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.notion-breadcrumb-item:hover {
  background: var(--notion-surface-hover);
  color: var(--notion-text);
}

.notion-breadcrumb-active {
  color: var(--notion-text);
  font-weight: 600;
}

.notion-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.notion-tool-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 0.375rem;
  color: var(--notion-text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.notion-tool-btn:hover {
  background: var(--notion-surface-hover);
  color: var(--notion-text);
}

.notion-tool-btn.active {
  color: #f1c742;
}

/* ── Notion Title & Subtitle ── */
.notion-title-section {
  margin-bottom: 1.5rem;
}

.notion-page-title {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--notion-text);
  margin: 0;
  line-height: 1.15;
}

.notion-page-subtitle {
  font-size: 0.9375rem;
  color: var(--notion-text-muted);
  margin-top: 0.375rem;
  font-weight: 400;
}

/* ── Notion Properties Grid ── */
.notion-properties-card {
  padding: 0.25rem 0 0.25rem 1.25rem;
  margin-bottom: 2rem;
}

.notion-properties-grid {
  display: grid;
  grid-template-columns: 1fr;
  row-gap: 0.625rem;
  column-gap: 2rem;
}

@media (min-width: 768px) {
  .notion-properties-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.notion-property-row {
  position: relative;
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: start;
  min-height: 28px;
  font-size: 0.84rem;
  padding: 0.25rem 1.75rem 0.25rem 0.375rem;
  border-radius: 0.375rem;
  transition: background 0.15s ease;
}

.notion-property-row:hover {
  background: var(--notion-surface-hover);
}

.notion-drag-handle {
  position: absolute;
  left: -1.25rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem !important;
  color: var(--notion-text-subtle);
  opacity: 0;
  cursor: grab;
  transition: opacity 0.15s ease;
}

.notion-property-row:hover .notion-drag-handle {
  opacity: 1;
}

.notion-property-editor {
  width: 100% !important;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  font: inherit !important;
  font-size: 0.84rem !important;
  color: var(--notion-text) !important;
  padding: 0 !important;
  margin: 0 !important;
}

.notion-property-editor:focus {
  outline: none !important;
  box-shadow: none !important;
  border-color: transparent !important;
}

.notion-property-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--notion-text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  user-select: none;
  line-height: 1.3;
  padding-top: 0.125rem;
}

.notion-property-icon {
  font-size: 1rem !important;
  color: var(--notion-text-subtle);
  flex-shrink: 0;
}

.notion-property-value {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-wrap: wrap;
  color: var(--notion-text);
  font-weight: 500;
  word-break: break-word;
  min-height: 24px;
}

.notion-property-value.is-empty {
  color: var(--notion-text-subtle);
  font-style: italic;
  font-weight: 400;
  opacity: 0.75;
  cursor: pointer;
}

.notion-property-value.is-empty:hover {
  color: var(--notion-accent);
  opacity: 1;
}

/* Bouton crayon, révélé au survol de la ligne — même pattern que
   .notion-description-edit-btn, pour une édition explicite sans avoir à
   deviner qu'un double-clic est possible. */
.notion-property-edit-btn {
  position: absolute;
  top: 50%;
  right: 0.375rem;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.notion-property-row:hover .notion-property-edit-btn {
  opacity: 1;
}

/* ── Section Description (Markdown + images inline) ── */
.notion-description-block {
  padding: 0.25rem 0;
  margin-bottom: 2rem;
  position: relative;
}

.notion-description-empty {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--notion-text-subtle);
  font-style: italic;
  cursor: pointer;
  font-size: 0.875rem;
}

.notion-description-empty:hover {
  color: var(--notion-text-muted);
}

.notion-description-edit-btn {
  position: absolute;
  top: 0.25rem;
  right: 0;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.notion-description-block.group:hover .notion-description-edit-btn {
  opacity: 1;
}

.notion-description-rendered {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--notion-text);
}

.notion-description-rendered > *:first-child { margin-top: 0; }
.notion-description-rendered > *:last-child { margin-bottom: 0; }

.notion-description-rendered h1,
.notion-description-rendered h2,
.notion-description-rendered h3 {
  font-weight: 700;
  margin: 0.75rem 0 0.375rem;
  color: var(--notion-text);
  line-height: 1.3;
}

.notion-description-rendered h1 { font-size: 1.375rem; }
.notion-description-rendered h2 { font-size: 1.15rem; }
.notion-description-rendered h3 { font-size: 1rem; }

.notion-description-rendered p { margin: 0.5rem 0; }

.notion-description-rendered strong { font-weight: 700; color: var(--notion-text); }
.notion-description-rendered em { font-style: italic; }
.notion-description-rendered del { opacity: 0.65; }

.notion-description-rendered code {
  background: var(--notion-surface-hover);
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
  font-family: var(--notion-font-mono);
  font-size: 0.8em;
}

.notion-description-rendered pre {
  background: var(--notion-surface-hover);
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 0.5rem 0;
}

.notion-description-rendered pre code {
  background: none;
  padding: 0;
}

.notion-description-rendered blockquote {
  border-left: 3px solid var(--notion-border);
  padding-left: 0.875rem;
  color: var(--notion-text-muted);
  margin: 0.5rem 0;
}

.notion-description-rendered img {
  max-width: 100%;
  border-radius: 0.5rem;
  margin: 0.5rem 0;
  display: block;
}

.notion-description-rendered a {
  color: var(--color-primary);
  text-decoration: underline;
}

.notion-description-rendered ul,
.notion-description-rendered ol {
  padding-left: 1.5rem;
  margin: 0.5rem 0;
}

.notion-description-rendered li { margin: 0.2rem 0; }

/* ── Task list / to-do styling (Notion style) ── */
.notion-description-rendered ul:has(> li.notion-task-li),
.notion-description-rendered ul.notion-task-list {
  list-style: none;
  padding-left: 0.125rem;
}

.notion-description-rendered li.notion-task-li {
  list-style: none;
  margin: 0.35rem 0;
  display: flex;
  align-items: flex-start;
}

.notion-task-label {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  width: 100%;
}

.notion-task-checkbox {
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.2rem;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--color-primary);
  border-radius: 0.25rem;
  transition: transform 0.1s ease;
}

.notion-task-checkbox:active {
  transform: scale(0.9);
}

.notion-task-text {
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--notion-text);
  transition: color 0.15s ease, opacity 0.15s ease, text-decoration 0.15s ease;
}

.notion-task-li.is-done .notion-task-text {
  text-decoration: line-through;
  opacity: 0.45;
  color: var(--notion-text-muted);
}

.notion-description-textarea {
  width: 100%;
  min-height: 160px;
  background: transparent;
  border: none;
  padding: 0.25rem 0;
  font-size: 0.8125rem;
  color: var(--notion-text);
  font-family: var(--notion-font-mono);
  resize: vertical;
  line-height: 1.5;
}

.notion-description-textarea:focus {
  outline: none;
}

/* ── Popup flottant de mise en forme (sélection dans la description) ── */
.notion-format-popup {
  position: fixed;
  z-index: 3000;
  display: none;
  gap: 0.125rem;
  background: var(--notion-surface);
  border: 1px solid var(--notion-border);
  border-radius: 0.5rem;
  padding: 0.25rem;
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.35);
}

.notion-format-popup.open {
  display: flex;
}

/* ── Popover générique (Select/Multi-select, Éditeur de bannière, Éditeur d'icône) ── */
.notion-popover {
  position: fixed;
  z-index: 3000;
  display: none;
  background: var(--notion-surface);
  border: 1px solid var(--notion-border);
  border-radius: 0.625rem;
  box-shadow: 0 12px 32px -6px rgba(0, 0, 0, 0.4);
  padding: 0.5rem;
  max-height: 360px;
  overflow-y: auto;
}

/* !important partout ici : le plugin @tailwindcss/forms (chargé après ce
   fichier via le CDN Tailwind, index.html) applique son propre reset aux
   <input> par sélecteur d'attribut ([type="text"]) — même poids de
   spécificité qu'une classe, donc il gagne sur l'ordre de chargement sans
   !important, d'où le champ énorme au style par défaut du navigateur. */
.notion-select-search {
  width: 100% !important;
  padding: 0.4rem 0.5rem !important;
  margin-bottom: 0.35rem !important;
  font-size: 0.8rem !important;
  line-height: 1.4 !important;
  background: var(--notion-surface-hover) !important;
  border: 1px solid var(--notion-border) !important;
  border-radius: 0.375rem !important;
  color: var(--notion-text) !important;
  outline: none !important;
  box-shadow: none !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.notion-select-search:focus {
  border-color: var(--notion-accent) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--notion-accent) 22%, transparent) !important;
}

.notion-select-options {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  max-height: 220px;
  overflow-y: auto;
}

.notion-select-option {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.35rem 0.4rem;
  border-radius: 0.375rem;
  cursor: pointer;
}

.notion-select-option:hover {
  background: var(--notion-surface-hover);
}

.notion-select-create {
  color: var(--notion-text-muted);
  font-size: 0.78rem;
}

.notion-select-trigger {
  min-height: 34px;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--notion-border);
  border-radius: 0.5rem;
  cursor: pointer;
  background: var(--notion-surface);
}

.notion-select-trigger:hover {
  background: var(--notion-surface-hover);
}

/* ── Bannière : actions au survol + panneau latéral compact ── */
.notion-cover-edit-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.notion-cover:hover .notion-cover-edit-actions,
.notion-cover-edit-actions:focus-within {
  opacity: 1;
}

.notion-sidepeek-cover {
  height: 108px;
}

/* ── Éditeur de bannière / icône (popover) ── */
.notion-cover-editor-tabs,
.notion-icon-editor-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--notion-border);
  padding-bottom: 0.4rem;
}

.notion-cover-editor-tab,
.notion-icon-editor-tab {
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--notion-text-muted);
  background: transparent;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.notion-cover-editor-tab:hover,
.notion-icon-editor-tab:hover {
  background: var(--notion-surface-hover);
  color: var(--notion-text);
}

.notion-cover-editor-tab.active,
.notion-icon-editor-tab.active {
  background: var(--notion-surface-hover);
  color: var(--notion-text);
  font-weight: 700;
}

.notion-cover-editor-body {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.notion-cover-palette {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.4rem;
}

.notion-cover-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 0.375rem;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.15s ease;
}

.notion-cover-swatch:hover {
  transform: scale(1.08);
}

.notion-cover-swatch.active {
  border-color: var(--notion-accent, #2563eb);
}

.notion-cover-custom-color {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--notion-text-muted);
}

.notion-cover-custom-color input[type="color"] {
  width: 32px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--notion-border);
  border-radius: 0.3rem;
  cursor: pointer;
  background: none;
}

.notion-cover-upload-btn {
  width: 100%;
  text-align: center;
  font-size: 0.8rem;
}

.notion-cover-position {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.notion-cover-position input[type="range"] {
  width: 100%;
}

/* ── Constructeur de dégradé personnalisé (bannière + icône) ── */
.notion-gradient-builder {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-top: 0.5rem;
  margin-top: 0.35rem;
  border-top: 1px solid var(--notion-border);
}

.notion-gradient-builder-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--notion-text-muted);
}

.notion-gradient-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.notion-gradient-preview {
  flex: 1;
  height: 32px;
  border-radius: 0.4rem;
  border: 1px solid var(--notion-border);
}

.notion-gradient-type-toggle {
  display: flex;
  flex-shrink: 0;
  border: 1px solid var(--notion-border);
  border-radius: 0.4rem;
  overflow: hidden;
}

.notion-gradient-type-toggle button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  color: var(--notion-text-muted);
  background: var(--notion-surface);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.notion-gradient-type-toggle button:first-child {
  border-right: 1px solid var(--notion-border);
}

.notion-gradient-type-toggle button:hover {
  background: var(--notion-surface-hover);
  color: var(--notion-text);
}

.notion-gradient-type-toggle button.active {
  background: var(--notion-accent);
  color: #fff;
}

.notion-gradient-colors {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.notion-gradient-colors input[type="color"] {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--notion-border);
  border-radius: 50%;
  cursor: pointer;
  background: none;
}

.notion-gradient-add-color,
.notion-gradient-remove-color {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px dashed var(--notion-border);
  background: transparent;
  color: var(--notion-text-muted);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
}

.notion-gradient-add-color:hover,
.notion-gradient-remove-color:hover {
  border-color: var(--notion-accent);
  color: var(--notion-accent);
}

.notion-gradient-apply {
  width: 100%;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
}

/* ── Éditeur d'icône (popover) ── */
.notion-icon-editor-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--notion-text-muted);
  margin-bottom: 0.35rem;
}

.notion-icon-bg-swatches {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.notion-emoji-cat-header {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--notion-text-muted);
  margin: 0.5rem 0 0.25rem;
}

.notion-emoji-cat-header:first-child {
  margin-top: 0;
}

.notion-emoji-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.15rem;
  max-height: 220px;
  overflow-y: auto;
}

.notion-emoji-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  padding: 0.3rem 0;
  border-radius: 0.375rem;
  cursor: pointer;
  border: none;
  background: transparent;
  transition: background-color 0.1s ease;
}

.notion-emoji-btn:hover {
  background: var(--notion-surface-hover);
}

.notion-icon-remove {
  width: 100%;
  text-align: center;
  color: var(--notion-danger, #dc2626);
  font-size: 0.8rem;
}

.notion-description-toolbar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

.notion-description-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* ── Notion Tags / Badges ── */
.notion-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.2rem 0.55rem;
  border-radius: 0.375rem;
  font-size: 0.775rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.notion-tag-gray   { background: var(--notion-tag-gray-bg);   color: var(--notion-tag-gray-text); }
.notion-tag-brown  { background: var(--notion-tag-brown-bg);  color: var(--notion-tag-brown-text); }
.notion-tag-orange { background: var(--notion-tag-orange-bg); color: var(--notion-tag-orange-text); }
.notion-tag-yellow { background: var(--notion-tag-yellow-bg); color: var(--notion-tag-yellow-text); }
.notion-tag-green  { background: var(--notion-tag-green-bg);  color: var(--notion-tag-green-text); }
.notion-tag-blue   { background: var(--notion-tag-blue-bg);   color: var(--notion-tag-blue-text); }
.notion-tag-purple { background: var(--notion-tag-purple-bg); color: var(--notion-tag-purple-text); }
.notion-tag-pink   { background: var(--notion-tag-pink-bg);   color: var(--notion-tag-pink-text); }
.notion-tag-red    { background: var(--notion-tag-red-bg);    color: var(--notion-tag-red-text); }

/* ── Notion Relation Chip ── */
.notion-relation-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.2rem 0.6rem;
  background: var(--notion-surface-hover);
  border: 1px solid var(--notion-border);
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  color: var(--notion-text);
  cursor: pointer;
  transition: all 0.15s ease;
}

.notion-relation-chip:hover {
  background: var(--color-primary-container);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ── Notion Callout Box ── */
.notion-callout {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 0.875rem 1.125rem;
  background: var(--notion-surface);
  border: 1px solid var(--notion-border);
  border-radius: 0.625rem;
  margin-bottom: 1.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--notion-text);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.notion-callout-icon {
  font-size: 1.25rem !important;
  color: #f1c742;
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.notion-callout-info    { background: rgba(35, 131, 226, 0.08); border-color: rgba(35, 131, 226, 0.2); }
.notion-callout-info .notion-callout-icon { color: var(--color-primary); }
.notion-callout-warning { background: rgba(241, 199, 66, 0.08); border-color: rgba(241, 199, 66, 0.2); }
.notion-callout-warning .notion-callout-icon { color: #f1c742; }
.notion-callout-success { background: rgba(82, 196, 26, 0.08); border-color: rgba(82, 196, 26, 0.2); }
.notion-callout-success .notion-callout-icon { color: #52c41a; }
.notion-callout-danger  { background: rgba(255, 123, 114, 0.08); border-color: rgba(255, 123, 114, 0.2); }
.notion-callout-danger .notion-callout-icon { color: #ff7b72; }

/* ── Notion Linked Database Tab Bar ── */
.notion-tabs-container {
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--notion-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.notion-tabs-list {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.notion-tabs-list::-webkit-scrollbar {
  display: none;
}

.notion-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--notion-text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.notion-tab-btn:hover {
  color: var(--notion-text);
  background: var(--notion-surface-hover);
  border-radius: 0.375rem 0.375rem 0 0;
}

.notion-tab-btn.active {
  color: var(--color-primary);
  font-weight: 600;
  border-bottom-color: var(--color-primary);
}

.notion-tab-btn.tab-dragging {
  opacity: 0.35 !important;
  transform: scale(0.95);
}

.notion-tab-btn.tab-drop-target {
  background: var(--notion-surface-hover) !important;
  border-bottom: 2px dashed var(--color-primary) !important;
  border-radius: 0.375rem 0.375rem 0 0;
}

.notion-tab-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 9999px;
  background: var(--notion-border);
  color: var(--notion-text-muted);
}

.notion-tab-btn.active .notion-tab-badge {
  background: var(--color-primary-container);
  color: var(--color-primary);
}

/* ── Notion Inline Data Table ── */
.notion-table-wrapper {
  background: var(--notion-surface);
  border: 1px solid var(--notion-border);
  border-radius: 0.75rem;
  overflow: hidden;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.notion-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  text-align: left;
}

.notion-table th {
  background: var(--notion-surface-hover);
  color: var(--notion-text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--notion-border);
  border-right: 1px solid var(--notion-border-subtle);
}

.notion-table th:last-child {
  border-right: none;
}

.notion-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--notion-border-subtle);
  border-right: 1px solid var(--notion-border-subtle);
  color: var(--notion-text);
}

.notion-table td:last-child {
  border-right: none;
}

.notion-table tbody tr {
  transition: background 0.12s ease;
}

.notion-table tbody tr:hover {
  background: var(--notion-surface-hover);
}

.notion-table tbody tr:last-child td {
  border-bottom: none;
}

/* ── Notion Side-Peek Drawer Overlay ── */
.notion-sidepeek-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
  visibility: hidden;
  opacity: 0;
  transition: visibility 0.25s, opacity 0.25s ease;
}

.notion-sidepeek-overlay.open {
  visibility: visible;
  opacity: 1;
}

.notion-sidepeek-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.notion-sidepeek-drawer {
  position: relative;
  width: 720px;
  max-width: 92vw;
  height: 100vh;
  background: var(--notion-bg);
  border-left: 1px solid var(--notion-border);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.25);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.25s ease;
  display: flex;
  flex-direction: column;
}

.notion-sidepeek-overlay.open .notion-sidepeek-drawer {
  transform: translateX(0);
}

.notion-sidepeek-drawer.drawer-form-width {
  width: 640px;
}

@media (max-width: 640px) {
  .notion-sidepeek-drawer.drawer-form-width {
    width: 100vw;
    max-width: 100vw;
  }
}

/* ── Panneau déroulant générique (formulaires pilotés par S.modal/render()) ──
   Contrairement au side-peek ci-dessus (monté impérativement, toggle .open),
   ce panneau est recréé à chaque render() : l'entrée utilise une @keyframes
   (rejoue à chaque insertion DOM) plutôt qu'une transition CSS (qui ne
   jouerait pas puisque le nœud n'existe jamais dans un état "avant"). */
@keyframes drawerSlideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: flex-end;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.drawer-panel {
  position: relative;
  width: 640px;
  max-width: 92vw;
  height: 100vh;
  background: var(--notion-bg);
  border-left: 1px solid var(--notion-border);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.25);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  animation: drawerSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: background-color 0.25s ease;
}

.drawer-panel.drawer-narrow {
  width: 420px;
}

.drawer-header {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 1.25rem 1.5rem;
  background: var(--notion-bg);
  border-bottom: 1px solid var(--notion-border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  transition: background-color 0.25s ease;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.drawer-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--notion-border-subtle);
  background: var(--notion-surface);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  transition: background-color 0.25s ease;
}

@media (max-width: 640px) {
  .drawer-panel {
    width: 100vw;
    max-width: 100vw;
  }
}

.notion-sidepeek-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: var(--notion-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--notion-border-subtle);
  transition: background-color 0.25s ease;
}
