/* ════════════════════════════════════════════════════════════════
   AGENDA COLLABORATIF - STYLES
   ════════════════════════════════════════════════════════════════ */

:root {
  --bg:        #0f1117;
  --surface:   #181c27;
  --surface2:  #1e2333;
  --border:    #2a3050;
  --accent:    #5b6af0;
  --accent2:   #7c8dff;
  --text:      #e2e6f3;
  --text-muted:#7a84a8;
  --danger:    #e05c6b;
  --success:   #3ecf8e;
  --warn:      #f0a348;
  --font-ui:   'DM Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius:    10px;
  --radius-lg: 16px;
  --shadow:    0 4px 24px rgba(0,0,0,.45);
  --safe-top:  0px;
  --safe-bottom: 0px;
}

/* ── Thème Frigo (clair / froid) ──────────────────────────────── */
[data-theme="frigo"] {
  --bg:        #eef3f8;
  --surface:   #ffffff;
  --surface2:  #f0f4f9;
  --border:    #ccd8e6;
  --accent:    #3a6fd8;
  --accent2:   #5b8ef0;
  --text:      #1a2540;
  --text-muted:#6b7fa3;
  --danger:    #d03a4a;
  --success:   #1f9e6e;
  --warn:      #d08030;
  --shadow:    0 4px 24px rgba(60,90,140,.13);
}
[data-theme="frigo"] .fc .fc-daygrid-day { background: var(--surface2) !important; }
[data-theme="frigo"] .fc .fc-col-header-cell { background: var(--surface) !important; }
[data-theme="frigo"] .fc .fc-day-other { background: rgba(200,215,235,.35) !important; }
[data-theme="frigo"] .form-input { color-scheme: light; }
[data-theme="frigo"] .EasyMDEContainer .CodeMirror {
  background: var(--surface2) !important;
  color: var(--text) !important;
}
[data-theme="frigo"] .editor-toolbar { background: var(--surface) !important; }
[data-theme="frigo"] .CodeMirror-gutters { background: var(--surface) !important; }

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&family=JetBrains+Mono:wght@400;500&display=swap');

@supports (padding: max(0px)) {
  :root {
    --safe-top: max(0px, env(safe-area-inset-top));
    --safe-bottom: max(0px, env(safe-area-inset-bottom));
  }
}

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

body {
  padding-top: env(safe-area-inset-top);
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  height: 100dvh;
  display: flex;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 768px) {
  body { flex-direction: column; }
}

/* ════════════════════════════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════════════════════════════ */

.sidebar {
  width: 220px; min-width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 24px 0; gap: 4px; z-index: 10;
  overflow-y: auto;
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -220px;
    top: 0;
    bottom: 0;
    width: 220px;
    border-radius: 0;
    z-index: 999;
    transition: left .3s cubic-bezier(0.4, 0, 0.2, 1);
    padding-top: var(--safe-top);
  }
  .sidebar.open { left: 0; }
}

.sidebar-logo {
  padding: 0 20px 24px;
  font-size: 18px; font-weight: 600; letter-spacing: -.3px;
  color: var(--text); display: flex; align-items: center; gap: 10px;
}
.sidebar-logo .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 12px var(--accent);
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; cursor: pointer;
  font-size: 14px; font-weight: 500;
  color: var(--text-muted);
  transition: color .15s, background .15s;
  border-left: 2px solid transparent;
  user-select: none;
}
.nav-item:hover { color: var(--text); background: var(--surface2); }
.nav-item.active { color: var(--text); border-left-color: var(--accent); background: rgba(91,106,240,.1); }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-section {
  font-size: 10px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-muted);
  padding: 16px 20px 6px;
}
.sidebar-spacer { flex: 1; }

/* Connected users */
.sidebar-users {
  margin: 0 12px 8px;
  display: flex; flex-direction: column; gap: 4px;
}
.sidebar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: var(--radius);
  font-size: 12px; color: var(--text-muted);
  background: var(--surface2);
}
.sidebar-user img { width: 22px; height: 22px; border-radius: 50%; }
.sidebar-user .me-badge {
  margin-left: auto; font-size: 10px;
  background: rgba(91,106,240,.25); color: var(--accent2);
  padding: 1px 6px; border-radius: 10px; font-weight: 600;
}

/* View toggle */
.view-toggle-sidebar {
  margin: 0 12px 4px;
  display: flex;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.vtb {
  flex: 1; padding: 6px 0; font-size: 11px; font-weight: 600;
  color: var(--text-muted); cursor: pointer;
  border: none; background: none; font-family: var(--font-ui);
  transition: all .15s; text-align: center;
}
.vtb.active { background: var(--accent); color: #fff; }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 998;
  display: none;
  opacity: 0;
  transition: opacity .3s;
}
.sidebar-overlay.open {
  display: block;
  opacity: 1;
}

/* ════════════════════════════════════════════════════════════
   MAIN LAYOUT
   ════════════════════════════════════════════════════════════ */

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  height: 60px; display: flex; align-items: center;
  justify-content: space-between; padding: 0 28px;
  border-bottom: 1px solid var(--border); background: var(--surface);
  gap: 16px; flex-shrink: 0;
  padding-top: var(--safe-top);
}
@media (max-width: 768px) {
  .topbar { padding: 0 14px; height: 56px; }
}

.topbar-title { font-size: 15px; font-weight: 600; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.topbar-user {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; padding: 4px 8px; border-radius: var(--radius);
  transition: background .15s;
}
.topbar-user:hover { background: var(--surface2); }
.topbar-user img { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface2); object-fit: cover; }
.topbar-user span { font-size: 13px; font-weight: 500; }
@media (max-width: 480px) {
    /* On permet au conteneur de se comporter de manière plus flexible */
    .user-switcher-container {
        display: flex !important;
        flex-wrap: wrap; /* Permet aux items de passer à la ligne si besoin */
        gap: 4px;        /* Réduit l'espace entre les éléments */
    }

    .user-switcher-item {
        display: block !important;
        /* Réduit la taille des éléments pour qu'ils prennent moins de place */
        padding: 4px 8px !important; 
        font-size: 12px;
    }
    
    /* Si vous avez un texte associé, vous pouvez le masquer et ne garder que l'avatar */
    .user-switcher-item .label-text {
        display: none; 
    }
}
.hamburger {
  display: none;
  width: 40px; height: 40px;
  background: none; border: none;
  cursor: pointer; padding: 8px;
  color: var(--text-muted);
  transition: color .15s;
}
.hamburger:hover { color: var(--text); }
@media (max-width: 768px) {
  .hamburger { display: flex; align-items: center; justify-content: center; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; font-family: var(--font-ui);
  cursor: pointer; border: 1px solid transparent;
  transition: all .15s; white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent2); border-color: var(--accent2); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); background: var(--surface2); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
@media (max-width: 480px) {
  .btn { padding: 6px 10px; font-size: 12px; }
}

/* ── Calendar user filter ─────────────────────────────────── */
.calendar-user-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 12px 8px;
}

.cal-filter-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
  transition: background .15s;
}

.cal-filter-user:hover { background: var(--surface2); }

.cal-filter-user input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 2px solid var(--ucolor, var(--accent));
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
  position: relative;
}

.cal-filter-user input[type="checkbox"]:checked {
  background: var(--ucolor, var(--accent));
  border-color: var(--ucolor, var(--accent));
}

.cal-filter-user img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--ucolor, var(--border));
  flex-shrink: 0;
}

.cal-filter-user span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ════════════════════════════════════════════════════════════
   CONTENT WRAPPER
   ════════════════════════════════════════════════════════════ */

.content-wrapper {
  display: flex;
  flex: 1;
  overflow: hidden;
  gap: 0;
}

@media (max-width: 1024px) {
  .content-wrapper { flex-direction: column; }
  .content-item { width: 100% !important; min-width: 0; }
}

.content-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--border);
}
.content-item:last-child { border-right: none; }

@media (max-width: 768px) {
  .content-item { border-right: none; border-bottom: 1px solid var(--border); }
  .content-item:last-child { border-bottom: none; }
}

/* ════════════════════════════════════════════════════════════
   CALENDAR
   ════════════════════════════════════════════════════════════ */

#calendar-container {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  position: relative;
  display: flex;
  flex-direction: column;
}
#calendar-container .fc {
  flex: 1;
  min-height: 0;
}
@media (max-width: 768px) {
  #calendar-container { padding: 10px; }
}

.fc {
  font-family: var(--font-ui);
}

/*EMINI DEBUT */



/* ════════════════════════════════════════════════════════════
   BLOCAGE STRICT SUR 2 LIGNES (ANTI-SUT DE LIGNE MOBILE)
   ════════════════════════════════════════════════════════════ */
.fc .fc-header-toolbar {
  display: grid !important;
  grid-template-columns: auto 1fr; /* Col 1: juste la place du titre/aujourd'hui, Col 2: prend le reste */
  row-gap: 10px;                   /* Espace fixe entre les 2 lignes */
  column-gap: 8px;
  align-items: center;
  margin-bottom: 12px !important;
}

/* 🛑 1. On fait disparaître les blocs vides natifs qui prennent de la place pour rien */
.fc .fc-header-toolbar .fc-toolbar-chunk:empty {
  display: none !important;
}

/* 🛠️ 2. On dissout UNIQUEMENT le conteneur des boutons pour libérer les éléments */
.fc .fc-header-toolbar .fc-toolbar-chunk:has(.fc-button) {
  display: contents !important;
}

/* 📌 LIGNE 1 GAUCHE : Le bloc Titre complet (reste soudé avec la semaine) */
.fc .fc-header-toolbar .fc-toolbar-chunk:has(.fc-toolbar-title) {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  display: flex;
  flex-direction: column;
}
.fc .fc-toolbar-title {
  font-size: 1.15rem !important;
  font-weight: 600;
  text-align: left;
}
.fc .fc-week-subtitle {
  text-align: left;
  font-size: 11px !important;
  margin-top: 2px;
}

/* 📌 LIGNE 1 DROITE : Les flèches < et > */
.fc .fc-header-toolbar .fc-button-group:has(.fc-prev-button) {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  margin: 0 !important;
}

/* 📌 LIGNE 2 GAUCHE : Le bouton "Aujourd'hui" */
.fc .fc-today-button {
  grid-column: 1;
  grid-row: 2;
  justify-self: start;
  margin: 0 !important;
  padding: 6px 10px !important;
  font-size: 12.5px !important;
}

/* 📌 LIGNE 2 DROITE : Les boutons de Vues (Mois, Semaine, Jour, Liste) */
.fc .fc-header-toolbar .fc-button-group:not(:has(.fc-prev-button)) {
  grid-column: 2;
  grid-row: 2;
  width: 100%;
  display: flex !important;
  margin: 0 !important;
}

/* Répartition égale des onglets de vues sur tout l'espace restant */
.fc .fc-header-toolbar .fc-button-group:not(:has(.fc-prev-button)) .fc-button {
  flex: 1;
  text-align: center;
  padding: 6px 2px !important;
  font-size: 12px !important;
}

/* Nettoyage global des hauteurs de boutons */
.fc .fc-button {
  padding: 5px 10px !important;
}







/*GEMINI FIN*/
.fc .fc-button-primary {
  background-color: var(--accent) !important;
  border-color: var(--accent) !important;
}
.fc .fc-button-primary:hover {
  background-color: var(--accent2) !important;
  border-color: var(--accent2) !important;
}
.fc .fc-daygrid-day,
.fc .fc-col-header {
  background: var(--surface2);
  border-color: var(--border);
}
.fc .fc-event {
  background: var(--accent);
  border-color: var(--accent);
}

/* ════════════════════════════════════════════════════════════
   NOTES CONTAINER
   ════════════════════════════════════════════════════════════ */

/* Sur desktop : liste à gauche (300px fixe) + éditeur à droite (flex:1) */
#notes-item {
  display: flex;
  flex-direction: row;
  overflow: hidden;
}

.notes-container {
  display: flex;
  flex-direction: column;
  width: 300px;
  min-width: 240px;
  max-width: 340px;
  flex-shrink: 0;
  height: 100%;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

@media (max-width: 768px) {
  #notes-item {
    flex-direction: column;
    position: relative;
  }
  .notes-container {
    width: 100%;
    max-width: none;
    min-width: 0;
    border-right: none;
  }
}

.notes-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
}
@media (max-width: 768px) {
  .notes-header { padding: 12px; }
}

.notes-header-title {
  font-size: 14px;
  font-weight: 600;
  flex: 1;
}

.notes-search {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

#notes-search {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-ui);
  transition: border-color .15s;
  min-width: 0;
}
#notes-search:focus {
  outline: none;
  border-color: var(--accent);
}

.notes-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

#notes-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
  color: var(--text-muted);
  padding: 20px;
}

#notes-scroll {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
}

.note-card {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  background: var(--surface2);
  transition: all .15s;
  border-left: 3px solid transparent;
}
.note-card:hover {
  background: rgba(91,106,240,.1);
  border-left-color: var(--accent);
}
.note-card.active {
  background: rgba(91,106,240,.15);
  border-left-color: var(--accent);
  border-color: var(--accent);
}

/* Notes liées à un événement : bordure gauche verte */
.note-card.note-card-linked {
  border-left-color: var(--success);
}
.note-card.note-card-linked:hover {
  background: rgba(62,207,142,.08);
  border-left-color: var(--success);
}
.note-card.note-card-linked.active {
  background: rgba(62,207,142,.12);
  border-left-color: var(--success);
  border-color: var(--success);
}

.note-event-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(62,207,142,.15);
  color: var(--success);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.note-card-preview {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.note-card-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* ════════════════════════════════════════════════════════════
   NOTE EDITOR
   ════════════════════════════════════════════════════════════ */

#note-edit-view {
  display: none;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  height: 100%;
  border-left: none;
}

/* Placeholder quand aucune note n'est ouverte (desktop) */
#note-editor-placeholder {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 12px;
  font-size: 13px;
}
#note-editor-placeholder svg { opacity: 0.3; }

@media (max-width: 768px) {
  #note-editor-placeholder { display: none; }
}

@media (max-width: 768px) {
  #note-edit-view {
    position: fixed;
    inset: 0;
    z-index: 800;
    background: var(--bg);
    border: none;
    border-radius: 0;
    padding-top: var(--safe-top);
  }
}

.note-toolbar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: center;
}
.note-toolbar .btn { padding: 6px 12px; font-size: 12px; }

.note-title-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-ui);
  min-width: 150px;
  transition: background .15s, border-color .15s;
}
.note-title-input:focus {
  outline: none;
  border-color: var(--accent);
}
/* En mode preview, le titre est non-éditable : apparence discrète */
.note-title-input[readonly] {
  background: transparent;
  border-color: transparent;
  cursor: default;
}

.note-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#editor-body { flex: 1; display: flex; flex-direction: column; }
.CodeMirror { height: 100% !important; }

#preview-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  line-height: 1.6;
}
@media (max-width: 768px) {
  #preview-body { padding: 12px; }
}

/* Note tags */
.note-tags {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.tag-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  color: var(--text);
  font-size: 12px;
  font-family: var(--font-ui);
  flex: 1;
  min-width: 80px;
}
.tag-input:focus {
  outline: none;
  border-color: var(--accent);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(91,106,240,.2);
  color: var(--accent2);
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

/* Event attachment in notes */
.note-event-link {
  padding: 12px 16px;
  background: rgba(91,106,240,.1);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  margin: 8px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.note-event-link-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.note-event-link-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.note-event-link-date {
  font-size: 12px;
  color: var(--text-muted);
}

.note-event-link-remove {
  cursor: pointer;
  color: var(--danger);
  font-size: 16px;
  line-height: 1;
}

/* Markdown preview */
#preview-body h1,
#preview-body h2,
#preview-body h3 {
  color: var(--accent2);
  margin-top: 16px;
  margin-bottom: 8px;
}
#preview-body h1 { font-size: 1.8em; }
#preview-body h2 { font-size: 1.5em; }
#preview-body h3 { font-size: 1.2em; }
#preview-body p { margin-bottom: 8px; }
#preview-body ul,
#preview-body ol {
  margin-left: 20px;
  margin-bottom: 8px;
}
#preview-body li { margin-bottom: 4px; }
#preview-body code {
  background: var(--surface2);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: .9em;
}
#preview-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  margin-left: 0;
  margin-bottom: 8px;
  color: var(--text-muted);
}
#preview-body a {
  color: var(--accent);
  text-decoration: none;
}
#preview-body a:hover { text-decoration: underline; }
#preview-body ul {
  padding-left: 0;
  list-style: none;
}
#preview-body ul li:not(.task-item) {
  padding-left: 1.2em;
  position: relative;
}
#preview-body ul li:not(.task-item)::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

#preview-body .task-item {
  list-style: none;
  margin: 2px 0;
  padding: 0;
}

/* Zone de clic = toute la ligne */
.task-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 8px;
  transition: background .12s;
  width: 100%;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.task-label:hover { background: rgba(91,106,240,.08); }
.task-label:active { background: rgba(91,106,240,.14); }

/* Checkbox custom — grande, nette, tactile */
.task-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  min-width: 20px;
  border-radius: 6px;
  border: 2px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
  margin-top: 1px;
  position: relative;
  transition: background .15s, border-color .15s, transform .1s;
  flex-shrink: 0;
}
.task-checkbox:hover {
  border-color: var(--accent);
}
.task-checkbox:active {
  transform: scale(.9);
}
.task-checkbox:checked {
  background: var(--accent);
  border-color: var(--accent);
}
/* Coche SVG via pseudo-élément */
.task-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 6px;
  height: 11px;
  border: 2.5px solid #fff;
  border-left: none;
  border-top: none;
  transform: rotate(45deg);
}

/* Texte barré quand coché */
.task-text {
  flex: 1;
  line-height: 1.5;
  transition: opacity .2s, color .2s;
}
#preview-body .task-item.checked .task-text {
  text-decoration: line-through;
  opacity: 0.45;
}

/* ════════════════════════════════════════════════════════════
   MODALS
   ════════════════════════════════════════════════════════════ */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
}
.modal.open { display: flex; }

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
@media (max-width: 768px) {
  .modal-content {
    width: 100%;
    max-height: 100%;
    border-radius: 0;
  }
}

.modal-form {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-section {
  padding: 12px;
  background: var(--surface2);
  border-radius: var(--radius);
}

.form-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-ui);
}
.form-input:focus {
  outline: none;
  border-color: var(--accent);
}
.form-input::placeholder {
  color: var(--text-muted);
}

/* ════════════════════════════════════════════════════════════
   NOTIFICATIONS & INDICATORS
   ════════════════════════════════════════════════════════════ */

#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
@media (max-width: 480px) {
  #toast-container {
    bottom: calc(60px + var(--safe-bottom));
    right: 10px;
    left: 10px;
  }
}

.toast {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--text);
  font-size: 13px;
  animation: slideIn .3s ease-out;
  box-shadow: var(--shadow);
}
.toast.success { border-left-color: var(--success); border-left-width: 3px; }
.toast.error { border-left-color: var(--danger); border-left-width: 3px; }
.toast.info { border-left-color: var(--accent); border-left-width: 3px; }
.toast.confirm {
  border-left-color: var(--warn);
  border-left-width: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 280px;
}
@keyframes slideIn {
  from { transform: translateX(400px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.sync-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
  margin-right: 4px;
  animation: pulse .2s ease-in-out;
}
.sync-indicator.syncing {
  background: var(--warn);
  animation: pulse .6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}

/* ════════════════════════════════════════════════════════════
   NOTIFICATION PANEL
   ════════════════════════════════════════════════════════════ */
#notif-panel {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 320px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 999;
  box-shadow: var(--shadow);
  margin-top: 8px;
}

.notif-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}

.notif-item:hover {
  background: var(--surface2);
}

.notif-item:last-child {
  border-bottom: none;
}

@media (max-width: 768px) {
  #notif-panel {
    min-width: 280px;
    right: -10px;
  }
}

/* ════════════════════════════════════════════════════════════
   BOTTOM NAVIGATION (Mobile)
   ════════════════════════════════════════════════════════════ */

.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 100;
  /* ✅ Safe area pour Android et iOS */
  padding-top: 8px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  height: auto;  /* Auto-calculé avec padding */
}
@media (max-width: 768px) {
  .bottom-nav { display: flex; }
  /* ✅ Padding pour éviter que le contenu soit caché par la bottom-nav + safe area */
  body { padding-bottom: max(60px, calc(60px + env(safe-area-inset-bottom))); }
  /* Sur le tab chat, le form est sticky donc pas besoin du padding du body */
  /* Sur le tab chat + clavier Android, dvh recalcule la hauteur exacte visible */
  #tab-chat {
    height: 100dvh;
    max-height: 100dvh;
  }
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 11px;
  gap: 4px;
  transition: color .15s;
  padding: 8px 0;  /* Padding uniforme sans safe-bottom redondant */
}
.bottom-nav-item:hover,
.bottom-nav-item.active {
  color: var(--accent);
}
.bottom-nav-item svg { width: 20px; height: 20px; }

/* ════════════════════════════════════════════════════════════
   LOGIN SCREEN
   ════════════════════════════════════════════════════════════ */

#login-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  flex-direction: column;
  gap: 32px;
}
#login-screen.hidden { display: none; }

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 56px;
  text-align: center;
  box-shadow: var(--shadow);
  max-width: 420px;
  width: 90%;
}
@media (max-width: 480px) {
  .login-card { padding: 32px 20px; }
}

.login-logo {
  font-size: 32px; font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 8px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.login-logo .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 16px var(--accent);
}

.login-subtitle {
  color: var(--text-muted); font-size: 14px; margin-bottom: 36px;
}

.btn-google {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 24px; border-radius: var(--radius);
  background: #fff; color: #1a1a2e;
  font-size: 15px; font-weight: 600; font-family: var(--font-ui);
  cursor: pointer; border: none;
  transition: all .15s; width: 100%; justify-content: center;
}
.btn-google:hover { background: #f0f0f0; }
.btn-google svg { width: 20px; height: 20px; }

/* ════════════════════════════════════════════════════════════
   UTILITIES
   ════════════════════════════════════════════════════════════ */

.hidden { display: none !important; }

/* ════════════════════════════════════════════════════════════
   FULLCALENDAR DARK THEME OVERRIDES
   ════════════════════════════════════════════════════════════ */

/* Background général */
.fc-theme-standard td,
.fc-theme-standard th,
.fc-theme-standard .fc-scrollgrid {
  border-color: var(--border) !important;
}

/* Cellules du calendrier */
.fc .fc-daygrid-day {
  background: var(--surface2) !important;
}
.fc .fc-daygrid-day:hover {
  background: rgba(91,106,240,.06) !important;
}
.fc .fc-daygrid-day.fc-day-today {
  background: rgba(91,106,240,.15) !important;
}

/* En-têtes jours */
.fc .fc-col-header-cell {
  background: var(--surface) !important;
  border-color: var(--border) !important;
}
.fc .fc-col-header-cell-cushion {
  color: var(--text-muted) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  padding: 8px 4px !important;
}

/* Numéros de jours */
.fc .fc-daygrid-day-number {
  color: var(--text-muted) !important;
  text-decoration: none !important;
  font-size: 13px !important;
  padding: 6px 8px !important;
}
.fc .fc-day-today .fc-daygrid-day-number {
  color: var(--accent2) !important;
  font-weight: 700 !important;
}

/* Jours hors mois */
.fc .fc-day-other .fc-daygrid-day-number {
  color: rgba(122,132,168,.4) !important;
}
.fc .fc-day-other {
  background: rgba(15,17,23,.4) !important;
}

/* Toolbar */
.fc .fc-toolbar-title {
  color: var(--text) !important;
  font-size: 16px !important;
  font-weight: 600 !important;
}
.fc .fc-toolbar {
  margin-bottom: 16px !important;
}

/* Boutons toolbar */
.fc .fc-button {
  background: var(--surface2) !important;
  border-color: var(--border) !important;
  color: var(--text-muted) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  font-family: var(--font-ui) !important;
  padding: 6px 12px !important;
  box-shadow: none !important;
  height: 32px !important;
  line-height: 1 !important;
  vertical-align: middle !important;
}
.fc .fc-button:hover {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #fff !important;
}
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #fff !important;
}
.fc .fc-button:focus { box-shadow: none !important; }

/* Bouton "Aujourd'hui" distinct mais aligné */
.fc .fc-today-button {
  color: var(--accent) !important;
  font-weight: 700 !important;
}
.fc .fc-today-button:hover {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #fff !important;
}
.fc .fc-today-button:disabled {
  opacity: 0.4 !important;
  cursor: default !important;
}

/* Colonne gauche : < > au-dessus, Aujourd'hui en dessous centré */
.fc .fc-toolbar-chunk:first-child {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 4px !important;
}
.fc .fc-toolbar-chunk:first-child .fc-button-group {
  display: flex !important;
}
.fc .fc-toolbar-chunk:first-child .fc-today-button {
  width: 100% !important;
  text-align: center !important;
}

/* Notes liées dans la modale event */
.event-notes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin: 16px 0 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.event-note-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.event-note-card:hover {
  border-color: var(--accent);
  background: var(--surface);
}
.event-note-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
}
.event-note-card-preview {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.event-note-card-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Événements */
.fc .fc-event {
  border-radius: 4px !important;
  border: none !important;
  padding: 2px 6px !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
}
.fc .fc-event-title { color: #fff !important; }
.fc .fc-event-time { color: rgba(255,255,255,.8) !important; font-size: 11px !important; }

[data-theme="frigo"] .fc .fc-event-title { color: #fff !important; }
[data-theme="frigo"] .fc .fc-event-time  { color: rgba(255,255,255,.85) !important; }
[data-theme="frigo"] .fc .fc-event { color: #fff !important; }

/* Scrollgrid */
.fc .fc-scrollgrid { border-color: var(--border) !important; }
.fc .fc-scrollgrid-section > td { border-color: var(--border) !important; }

/* Time grid (vue semaine/jour) */
.fc .fc-timegrid-slot {
  background: var(--surface2) !important;
  border-color: var(--border) !important;
  height: 40px !important;
}
.fc .fc-timegrid-slot-label {
  color: var(--text-muted) !important;
  font-size: 11px !important;
}
.fc .fc-timegrid-now-indicator-line {
  border-color: var(--danger) !important;
}
.fc .fc-timegrid-now-indicator-arrow {
  border-top-color: var(--danger) !important;
}

/* Sélection */
.fc .fc-highlight {
  background: rgba(91,106,240,.2) !important;
}

/* ════════════════════════════════════════════════════════════
   VUE LISTE (listMonth) — compatibilité dark / frigo
   ════════════════════════════════════════════════════════════ */

/* Conteneur principal */
.fc .fc-list {
  background: var(--surface2) !important;
  border-color: var(--border) !important;
}

[data-theme="frigo"] .fc .fc-list-event-time,
[data-theme="frigo"] .fc .fc-list-event-title,
[data-theme="frigo"] .fc .fc-list-event-title * {
  color: #ffffff !important;
}

/* En-têtes de jour (ex : "lundi 12 mai") */
.fc .fc-list-day-cushion,
.fc .fc-list-day .fc-cell-shaded {
  background: var(--surface) !important;
}
.fc .fc-list-day-text,
.fc .fc-list-day-side-text {
  color: var(--text) !important;
}

/* Lignes d'événements */
.fc .fc-list-event {
  background: var(--surface2) !important;
  color: var(--text) !important;
}
.fc .fc-list-event:hover td {
  background: rgba(91,106,240,.1) !important;
}

/* Cellules dans les lignes d'événements */
.fc .fc-list-event td {
  border-color: var(--border) !important;
  color: var(--text) !important;
}

/* Heure */
.fc .fc-list-event-time {
  color: var(--text-muted) !important;
  font-size: 12px !important;
}

/* Titre de l'événement */
.fc .fc-list-event-title a {
  color: var(--text) !important;
  text-decoration: none !important;
}
.fc .fc-list-event-title a:hover {
  color: var(--accent2) !important;
}

/* Pastille couleur */
.fc .fc-list-event-dot {
  border-color: var(--accent) !important;
}

/* Message "aucun événement" */
.fc .fc-list-empty {
  background: var(--surface2) !important;
}
.fc .fc-list-empty-cushion {
  color: var(--text-muted) !important;
}

/* Thème frigo : surcharges spécifiques */
[data-theme="frigo"] .fc .fc-list {
  background: var(--surface2) !important;
}
[data-theme="frigo"] .fc .fc-list-day-cushion,
[data-theme="frigo"] .fc .fc-list-day .fc-cell-shaded {
  background: var(--surface) !important;
}
[data-theme="frigo"] .fc .fc-list-event {
  background: var(--surface2) !important;
}
[data-theme="frigo"] .fc .fc-list-event:hover td {
  background: rgba(58,111,216,.08) !important;
}

/* ════════════════════════════════════════════════════════════
   SYNC INDICATOR - VERSION VISIBLE
   ════════════════════════════════════════════════════════════ */

.sync-indicator {
  width: 8px !important;
  height: 8px !important;
  border-radius: 50% !important;
  background: var(--success) !important;
  display: inline-block !important;
  margin-right: 6px !important;
  flex-shrink: 0 !important;
  animation: none !important;
  box-shadow: 0 0 6px var(--success) !important;
}
.sync-indicator.syncing {
  background: var(--warn) !important;
  box-shadow: 0 0 6px var(--warn) !important;
  animation: pulse .8s ease-in-out infinite !important;
}

/* Topbar title alignement avec indicateur */
.topbar-title {
  display: flex !important;
  align-items: center !important;
  gap: 0 !important;
}

/* ════════════════════════════════════════════════════════════
   BOUTON SYNC GOOGLE CALENDAR
   ════════════════════════════════════════════════════════════ */
.btn-sync {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
  gap: 5px;
}
.btn-sync:hover {
  color: var(--text);
  background: var(--surface2);
  border-color: var(--accent);
}
.btn-sync:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ════════════════════════════════════════════════════════════
   ÉVÉNEMENTS COURTS - HAUTEUR MINIMALE
   ════════════════════════════════════════════════════════════ */
.fc .fc-timegrid-event {
  min-height: 28px !important;
  overflow: hidden !important;
}
.fc .fc-timegrid-event .fc-event-main {
  padding: 2px 4px !important;
  overflow: hidden !important;
}
.fc .fc-timegrid-event .fc-event-title {
  font-size: 11px !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  line-height: 1.3 !important;
}
.fc .fc-timegrid-event .fc-event-time {
  font-size: 10px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  opacity: 0.85 !important;
  line-height: 1.2 !important;
}
/* Événements très courts : masquer l'heure, juste le titre */
.fc .fc-timegrid-event-short .fc-event-time {
  display: none !important;
}
.fc .fc-timegrid-event-short .fc-event-title {
  font-size: 10px !important;
}

/* ════════════════════════════════════════════════════════════
   TOPBAR MOBILE - COMPACTE
   ════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
  .topbar { padding: 0 10px !important; gap: 6px !important; }
  .topbar-title { font-size: 13px !important; }
  #btn-sync-gcal { padding: 6px 8px !important; font-size: 11px !important; }
  #btn-new-event { padding: 6px 8px !important; font-size: 11px !important; }
  #btn-new-note  { padding: 6px 8px !important; font-size: 11px !important; }
  .topbar-user img { width: 24px !important; height: 24px !important; }
}
@media (max-width: 420px) {
  /* Sur très petit écran : masquer le texte GCal, garder icône */
  #btn-sync-gcal span { display: none; }
  #btn-new-event { display: none !important; } /* le + flottant suffit */
}

/* Bouton retour note — visible surtout sur mobile */
.note-back-btn {
  flex-shrink: 0;
  padding: 6px 8px !important;
}
@media (min-width: 769px) {
  .note-back-btn { display: none; }
}

/* ════════════════════════════════════════════════════════════
   EASYMDE DARK THEME OVERRIDES
   ════════════════════════════════════════════════════════════ */

/* Container */
.EasyMDEContainer {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* Toolbar */
.editor-toolbar {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  border-top-left-radius: var(--radius) !important;
  border-top-right-radius: var(--radius) !important;
  padding: 6px 10px !important;
}

.editor-toolbar button {
  color: var(--text-muted) !important;
  background: transparent !important;
  border-color: transparent !important;
  border-radius: 6px !important;
}
.editor-toolbar button:hover,
.editor-toolbar button.active {
  background: var(--surface2) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

/* Séparateurs */
.editor-toolbar i.separator {
  border-left-color: var(--border) !important;
  border-right-color: transparent !important;
}

/* CodeMirror — zone de texte principale */
.EasyMDEContainer .CodeMirror {
  background: var(--surface2) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
  border-bottom-left-radius: var(--radius) !important;
  border-bottom-right-radius: var(--radius) !important;
  font-family: var(--font-ui) !important;
  font-size: 14px !important;
  flex: 1;
  height: 100% !important;
}

/* Curseur */
.EasyMDEContainer .CodeMirror-cursor {
  border-left-color: var(--text) !important;
}

/* Gutters (numéros de ligne) */
.CodeMirror-gutters {
  background: var(--surface) !important;
  border-right-color: var(--border) !important;
}
.CodeMirror-linenumber {
  color: var(--text-muted) !important;
}

/* Sélection */
.CodeMirror-selected,
.CodeMirror-focused .CodeMirror-selected {
  background: rgba(91,106,240,.25) !important;
}
.CodeMirror-line::selection,
.CodeMirror-line > span::selection,
.CodeMirror-line > span > span::selection {
  background: rgba(91,106,240,.25) !important;
}

/* Ligne active */
.CodeMirror-activeline-background {
  background: rgba(91,106,240,.06) !important;
}

/* Scrollbar interne CodeMirror */
.CodeMirror-scroll {
  background: var(--surface2) !important;
}

/* Syntaxe markdown dans l'éditeur */
.cm-s-easymde .cm-header-1,
.cm-s-easymde .cm-header-2,
.cm-s-easymde .cm-header-3,
.cm-s-easymde .cm-header-4,
.cm-s-easymde .cm-header-5,
.cm-s-easymde .cm-header-6 {
  color: var(--accent2) !important;
}
.cm-s-easymde .cm-quote   { color: var(--text-muted) !important; }
.cm-s-easymde .cm-link    { color: var(--accent) !important; }
.cm-s-easymde .cm-url     { color: var(--accent2) !important; }
.cm-s-default .cm-header  { color: var(--accent2) !important; }
.cm-s-default .cm-link    { color: var(--accent) !important; }
.cm-s-default .cm-comment { background: rgba(91,106,240,.08) !important; }

/* Checkbox dans l'éditeur (mode edit) */
.EasyMDEContainer .CodeMirror input[type="checkbox"] {
  accent-color: var(--accent);
}

/* Preview EasyMDE intégrée (si utilisée) */
.editor-preview,
.editor-preview-side {
  background: var(--surface2) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
.editor-preview pre {
  background: var(--surface) !important;
}

/* Fullscreen toolbar */
.editor-toolbar.fullscreen {
  background: var(--surface) !important;
  border-bottom: 1px solid var(--border) !important;
}
.EasyMDEContainer .CodeMirror-fullscreen {
  background: var(--bg) !important;
}

/* ════════════════════════════════════════════════════════════
   DÉSACTIVER LE SCROLL VERTICAL DU FC-SCROLLER SUR DESKTOP
   (évite la double scrollbar dans la vue semaine/jour)
   ════════════════════════════════════════════════════════════ */

@media (min-width: 769px) {
  .fc-scroller {
    overflow-y: hidden !important;
  }
  /* Mais on garde le scroll pour la grille liquide en vue mois */
  .fc-scroller-liquid-absolute {
    overflow-y: auto !important;
  }
}

/* ════════════════════════════════════════════════════════════
   FORM-INPUT — couleur icône calendrier/heure alignée sur le texte
   ════════════════════════════════════════════════════════════ */

.form-input {
  color-scheme: dark;
}

/* ════════════════════════════════════════════════════════════
   SUPPRIMER LE NOTES-HEADER (remplacé par le topbar)
   ════════════════════════════════════════════════════════════ */

.notes-header {
  display: none !important;
}

/* ════════════════════════════════════════════════════════════
   USER SWITCHER (clic avatar topbar)
   ════════════════════════════════════════════════════════════ */

#topbar-user { position: relative; }

.user-switcher-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface2);       /* fond plus clair que surface pour contraste */
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,.6);
  z-index: 600;
  min-width: 190px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-switcher-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  color: var(--text);               /* texte clair par défaut */
  transition: background .15s, color .15s;
}
.user-switcher-item:hover  { background: rgba(255,255,255,.07); color: var(--text); }
.user-switcher-item.active { color: var(--text); background: rgba(91,106,240,.18); }

@media (max-width: 768px) {
  .user-switcher-menu {
    /* Sur mobile : ancré à droite avec marge pour ne pas sortir de l'écran */
    right: 4px;
    min-width: 210px;
    box-shadow: 0 12px 40px rgba(0,0,0,.75);
  }
}

.user-switcher-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
}
.user-switcher-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Indicateur filtre actif sur l'avatar */
.user-filter-indicator {
  position: absolute;
  bottom: 2px; right: 6px;
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 2px solid var(--surface);
}



/* ════════════════════════════════════════════════════════════
   NOTE CARD — pastille auteur
   ════════════════════════════════════════════════════════════ */

.note-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}
/* On retire le margin-bottom de note-card-title quand il est dans le header */
.note-card-header .note-card-title { margin-bottom: 0; }

.note-author-avatar {
  width: 18px; height: 18px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid;
  flex-shrink: 0;
}
.note-author-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════
   EVENT TAGS (dans la modale)
   ════════════════════════════════════════════════════════════ */

.event-tags-area {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
}
.event-tags-display {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* Tags dans les événements du calendrier */
.fc-event-tags {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  margin-top: 1px;
}
.fc-event-tag {
  font-size: 9px;
  background: rgba(255,255,255,.2);
  border-radius: 3px;
  padding: 0 4px;
  line-height: 14px;
  white-space: nowrap;
}

/* ════════════════════════════════════════════════════════════
   FAB — Bouton flottant "+ Événement" (mobile uniquement)
   ════════════════════════════════════════════════════════════ */

.fab-new-event {
  display: none;
}
@media (max-width: 768px) {
  .fab-new-event {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    /* ✅ Ajusté : hauteur bottom-nav (60px) + padding + safe area */
    bottom: max(calc(70px + var(--safe-bottom)), calc(70px + env(safe-area-inset-bottom)));
    right: 16px;
    width: 52px; height: 52px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(91,106,240,.5);
    z-index: 200;
    transition: background .15s, transform .15s, box-shadow .15s;
  }
  .fab-new-event:hover {
    background: var(--accent2);
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(91,106,240,.6);
  }
  .fab-new-event:active { transform: scale(.95); }

  /* Sur mobile, masquer le bouton topbar "+ Événement" (le FAB suffit) */
  #btn-new-event { display: none !important; }
}

/* ════════════════════════════════════════════════════════════
   FAB — Bouton flottant "+ Note" (mobile uniquement)
   ════════════════════════════════════════════════════════════ */

.fab-new-note {
  display: none;
}
@media (max-width: 768px) {
  .fab-new-note {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    /* ✅ Ajusté : hauteur bottom-nav (60px) + padding + safe area */
    bottom: max(calc(70px + var(--safe-bottom)), calc(70px + env(safe-area-inset-bottom)));
    right: 16px;
    width: 52px; height: 52px;
    border-radius: 50%;
    background: var(--success);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(62,207,142,.45);
    z-index: 200;
    transition: background .15s, transform .15s, box-shadow .15s;
  }
  .fab-new-note:hover {
    background: #2eb87a;
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(62,207,142,.55);
  }
  .fab-new-note:active { transform: scale(.95); }

  /* Sur mobile, masquer le bouton topbar "+ Note" (le FAB suffit) */
  #btn-new-note { display: none !important; }
}

/* ════════════════════════════════════════════════════════════
   EVENT TAG FILTER BAR
   ════════════════════════════════════════════════════════════ */

.event-tag-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  color: var(--text-muted);
}
@media (max-width: 768px) {
  .event-tag-filter-bar { padding: 6px 10px; }
}

#event-tag-search {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  color: var(--text);
  font-size: 12px;
  font-family: var(--font-ui);
  min-width: 0;
  transition: border-color .15s;
}
#event-tag-search:focus {
  outline: none;
  border-color: var(--accent);
}
#event-tag-search::placeholder { color: var(--text-muted); }

.event-tag-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
  transition: color .15s;
}
.event-tag-clear:hover { color: var(--danger); }

/* ════════════════════════════════════════════════════════════
   WEEK NUMBERS
   ════════════════════════════════════════════════════════════ */

.fc .fc-daygrid-week-number {
  color: var(--text-muted) !important;
  font-size: 10px !important;
  font-weight: 600 !important;
  opacity: 0.6;
  padding: 4px 6px !important;
  background: transparent !important;
}

/* ════════════════════════════════════════════════════════════
   TAG INPUT — masqué en mode aperçu
   ════════════════════════════════════════════════════════════ */

.note-tags .tag-input {
  transition: opacity .15s;
}

/* ════════════════════════════════════════════════════════════
   BOUTONS THÈME
   ════════════════════════════════════════════════════════════ */
.theme-btn {
  flex: 1;
  padding: 6px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 12px; font-weight: 500;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: all .15s;
}
.theme-btn:hover { background: var(--border); color: var(--text); }
.theme-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
/* ════════════════════════════════════════════════════════════════
   COLOR SWATCH PICKER
   ════════════════════════════════════════════════════════════════ */
.color-swatch-picker {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 6px 2px;
  flex-wrap: wrap;
}
.color-swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform .15s, border-color .15s, box-shadow .15s;
  outline: none;
  position: relative;
  flex-shrink: 0;
}
.color-swatch:hover {
  transform: scale(1.15);
  box-shadow: 0 0 0 3px rgba(255,255,255,.18);
}
.color-swatch.selected {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--text);
  transform: scale(1.12);
}
.color-swatch.selected::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
}

/* ── Bouton d'heure custom ──────────────────────────────────── */
.time-clock-btn {
  cursor: pointer;
  text-align: center;
  font-size: 15px;
  letter-spacing: .04em;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background .15s, border-color .15s;
  user-select: none;
}
.time-clock-btn:hover { background: var(--border); border-color: var(--accent); }
.time-clock-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ════════════════════════════════════════════════════════════════
   CLOCK PICKER OVERLAY
   ════════════════════════════════════════════════════════════════ */
.clock-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.clock-picker-box {
  background: var(--surface);
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 24px 24px 18px;
  width: 312px;
  max-width: 95vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
/* Affichage HH:MM en haut */
.clock-header-display {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface2);
  border-radius: 12px;
  padding: 8px 18px;
  align-self: stretch;
  justify-content: center;
}
.clock-hm {
  font-size: 42px;
  font-weight: 600;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 8px;
  padding: 4px 10px;
  transition: background .12s, color .12s;
  min-width: 64px;
  text-align: center;
}
.clock-hm-active {
  color: var(--text);
  background: rgba(91,106,240,.18);
}
.clock-hm:hover:not(.clock-hm-active) { background: var(--border); }
.clock-sep {
  font-size: 42px;
  font-weight: 300;
  color: var(--text-muted);
  line-height: 1;
}
/* Face SVG */
.clock-face-wrap {
  width: 264px;
  height: 264px;
  flex-shrink: 0;
}
.clock-svg {
  width: 100%;
  height: 100%;
  cursor: pointer;
  touch-action: none;
}
.clock-bg-circle { fill: var(--surface2); }
.clock-hand-line {
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  transition: x2 .12s, y2 .12s;
}
.clock-hand-tip {
  fill: var(--accent);
  transition: cx .12s, cy .12s;
}
.clock-center-dot { fill: var(--accent); }
.clock-number {
  font-size: 16px;
  font-weight: 500;
  fill: var(--text);
  text-anchor: middle;
  dominant-baseline: central;
  cursor: pointer;
  transition: fill .1s;
  user-select: none;
}
.clock-number-inner {
  font-size: 13px;
  fill: var(--text-muted);
}
.clock-number.selected { fill: #fff; }
.clock-number-bg {
  fill: transparent;
  cursor: pointer;
  r: 18;
}
.clock-number-bg.selected { fill: var(--accent); }
.clock-number-bg.hovered  { fill: var(--border); }
/* Actions */
.clock-actions {
  display: flex;
  gap: 10px;
  align-self: stretch;
  justify-content: flex-end;
}

/* search */
/* search fullscreen */
#search-overlay {
  position: fixed;
  /* Desktop : laisser la sidebar (220px) visible à gauche */
  top: 0;
  left: 220px;
  right: 0;
  bottom: 0;
  z-index: 10000;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  /* APK Android desktop : descendre sous la status bar si présente */
  padding-top: env(safe-area-inset-top);
}
@media (max-width: 768px) {
  #search-overlay {
    /* Mobile web + APK : plein écran mais respecter les safe areas */
    left: 0;
    top: env(safe-area-inset-top);
    /* Laisser la bottom-nav visible */
    bottom: max(60px, calc(60px + env(safe-area-inset-bottom)));
    padding-top: 0;
  }
}
#search-overlay.hidden { display:none; }
.search-fs-header { display:flex;align-items:center;gap:12px;padding:14px 16px;border-bottom:1px solid var(--border);flex-shrink:0; }
.search-fs-header svg { color:var(--text-muted);flex-shrink:0; }
.search-fs-header input { flex:1;background:none;border:none;outline:none;font-size:16px;color:var(--text); }
.search-fs-header button { background:none;border:none;cursor:pointer;color:var(--text-muted);font-size:20px;padding:0 4px; }
.search-fs-results { flex:1;overflow-y:auto;padding:8px 0; }
.search-section-title { padding:10px 16px 4px;font-size:11px;font-weight:600;text-transform:uppercase;color:var(--text-muted);letter-spacing:.06em; }
.search-item { padding:10px 16px;cursor:pointer;transition:background .15s; }
.search-item:hover { background:var(--surface2); }
.search-item-title { font-size:14px;font-weight:500;color:var(--text); }
.search-item-meta { font-size:11px;color:var(--text-muted);margin-top:2px; }
.search-item-snippet { font-size:12px;color:var(--text-muted);margin-top:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
.search-item mark { background:transparent;color:var(--accent);font-weight:600; }
.search-empty,.search-loading { padding:40px;text-align:center;color:var(--text-muted);font-size:13px; }

/* ════════════════════════════════════════════════════════════
   CHAT
   ════════════════════════════════════════════════════════════ */

/* ── Tab container ──────────────────────────────────────────── */
#tab-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* ── Load more ──────────────────────────────────────────────── */
.chat-load-more { text-align: center; padding: 6px; flex-shrink: 0; }
.chat-load-more.hidden { display: none; }
.chat-load-more button {
  background: none; border: 1px solid var(--border);
  border-radius: 8px; padding: 4px 12px; cursor: pointer; font-size: 12px;
  color: var(--text-muted);
}
.chat-load-more button:hover { background: var(--border); }

/* ── Messages list ──────────────────────────────────────────── */
.chat-messages {
  flex: 1; overflow-y: auto; padding: 12px 12px 4px;
  display: flex; flex-direction: column; gap: 10px;
  scroll-behavior: smooth;
}
.chat-empty {
  text-align: center; color: var(--text-muted);
  font-size: 13px; margin: auto 0;
}

/* ── Message ────────────────────────────────────────────────── */
.chat-message {
  display: flex; gap: 8px; align-items: flex-start; transition: opacity .3s;
}
.chat-message--mine { flex-direction: row-reverse; }
.chat-msg--deleted  { opacity: 0; }

/* ── Avatar ─────────────────────────────────────────────────── */
.chat-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
}
.chat-avatar--initials {
  background: #e05c6b; color: #fff;
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ── Bubble ─────────────────────────────────────────────────── */
.chat-bubble { max-width: calc(100% - 48px); }
.chat-meta   { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.chat-message--mine .chat-meta { flex-direction: row-reverse; }
.chat-author { font-size: 11px; font-weight: 600; color: var(--text-muted); }
.chat-time   { font-size: 10px; color: var(--text-muted); }
.chat-delete-btn {
  background: none; border: none; cursor: pointer;
  font-size: 11px; opacity: 0; padding: 0 2px; transition: opacity .15s;
}
.chat-message:hover .chat-delete-btn { opacity: 1; }
.chat-content {
  margin: 0; padding: 8px 12px;
  background: var(--surface2);
  border-radius: 0 12px 12px 12px;
  font-size: 14px; line-height: 1.45;
  word-break: break-word; white-space: pre-wrap;
  color: var(--text);
}
.chat-message--mine .chat-content {
  background: #e05c6b; color: #fff;
  border-radius: 12px 0 12px 12px;
}

/* ── Form ───────────────────────────────────────────────────── */
.chat-form {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
  /* Reste visible au-dessus du clavier virtuel sur mobile */
  position: sticky;
  bottom: 0;
}
.chat-input {
  flex: 1; resize: none;
  border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 12px;
  font-size: 14px; font-family: inherit;
  background: var(--surface2);
  color: var(--text);
  outline: none; transition: border-color .2s;
  line-height: 1.4; overflow-y: hidden;
}
.chat-input:focus { border-color: #e05c6b; }
.chat-input::placeholder { color: var(--text-muted); }
.chat-send {
  width: 36px; height: 36px;
  background: #e05c6b; color: #fff;
  border: none; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .2s, transform .15s;
}
.chat-send:hover     { background: #d04555; transform: scale(1.08); }
.chat-send:disabled  { opacity: .5; cursor: not-allowed; transform: none; }
.chat-send svg       { width: 16px; height: 16px; }

/* ── Réactions ──────────────────────────────────────────────── */
.chat-reactions {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px;
}
.chat-reaction-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px; padding: 2px 7px;
  font-size: 13px; cursor: pointer; transition: background .15s;
  color: var(--text);
}
.chat-reaction-btn:hover  { background: var(--border); }
.chat-reaction-btn.mine   { border-color: #e05c6b; background: rgba(224,92,107,.15); }
.chat-reaction-add {
  background: none; border: 1px dashed var(--border);
  border-radius: 12px; padding: 2px 7px; font-size: 13px;
  cursor: pointer; color: var(--text-muted);
  transition: border-color .15s;
}
.chat-reaction-add:hover { border-color: #e05c6b; color: #e05c6b; }
.chat-emoji-picker {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 6px;
  display: flex; gap: 4px; z-index: 9999;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.chat-emoji-picker button {
  background: none; border: none; font-size: 20px;
  cursor: pointer; border-radius: 6px; padding: 2px 4px;
  transition: background .15s;
}
.chat-emoji-picker button:hover { background: var(--border); }

/* ── Mentions ───────────────────────────────────────────────── */
.chat-mention {
  color: inherit; font-weight: 700;
  text-decoration: underline; text-underline-offset: 2px;
  border-radius: 4px; padding: 0 2px; opacity: 0.95;
}
.chat-mention--me { background: rgba(0,0,0,.2); }
.chat-mention-dropdown {
  position: absolute; bottom: calc(100% + 4px); left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
  z-index: 950; min-width: 160px;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.chat-mention-item {
  display: block; width: 100%;
  background: none; border: none; text-align: left;
  padding: 7px 14px; font-size: 13px; cursor: pointer;
  color: var(--text); transition: background .1s;
}
.chat-mention-item:hover { background: var(--border); }

/* ════════════════════════════════════════════════════════════════
   MODAL RDV — boutons d'action compacts
   ════════════════════════════════════════════════════════════════ */
.event-modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  align-items: center;
}
.event-modal-actions .fav-mbtn { flex: 1; }

/* Boutons icône seule (poubelle, cloche, suppr récurrence) */
.event-btn-icon {
  flex: 0 0 auto !important;
  width: 36px;
  height: 36px;
  padding: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Récurrence — ligne select + bouton supprimer récurrences */
.event-recurrence-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
.event-recurrence-row select { flex: 1; font-size: 12px; }
