/* =================================================================
 * Mémo — v1.1.0
 * Design moderne : Geist, palette zinc + rose, formes géométriques.
 * Toutes les classes sont préfixées `memo-` pour éviter les conflits
 * avec le thème WordPress.
 * ================================================================= */

/* L'app prend toute la fenêtre quand l'utilisateur est connecté */
.memo-app-root {
  /* --- Couleurs --- */
  --memo-bg:            #FAFAFA;
  --memo-bg-soft:       #F4F4F5;
  --memo-card:          #FFFFFF;
  --memo-text:          #09090B;
  --memo-text-soft:     #52525B;
  --memo-text-faint:    #A1A1AA;
  --memo-border:        #E4E4E7;
  --memo-border-strong: #D4D4D8;
  --memo-accent:        #E11D48;
  --memo-accent-soft:   #FFE4E6;
  --memo-accent-dark:   #9F1239;
  --memo-success:       #16A34A;
  --memo-success-soft:  #DCFCE7;
  --memo-error:         #DC2626;

  /* --- Ombres --- */
  --memo-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --memo-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 4px rgba(0, 0, 0, 0.03);
  --memo-shadow:    0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.04);
  --memo-shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.05), 0 12px 24px rgba(0, 0, 0, 0.08);

  /* --- Animations --- */
  --memo-ease: cubic-bezier(0.2, 0.7, 0.3, 1);

  position: fixed;
  inset: 0;
  z-index: 99990;
  background: var(--memo-bg);
  color: var(--memo-text);
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-y: auto;
  overflow-x: hidden;
  padding-top: env(safe-area-inset-top);
  letter-spacing: -0.005em;
}
.memo-app-root * { box-sizing: border-box; }
.memo-app-root button { font-family: inherit; font-size: inherit; }

/* --- Boot loader ------------------------------------------------- */
.memo-boot-loader {
  position: absolute;
  inset: 0;
  background: var(--memo-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: opacity 0.3s var(--memo-ease);
}
.memo-boot-loader.memo-hidden { opacity: 0; pointer-events: none; }
.memo-boot-spinner {
  display: flex;
  gap: 4px;
}
.memo-boot-spinner span {
  display: block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--memo-text);
  animation: memo-pulse 1.4s ease-in-out infinite;
}
.memo-boot-spinner span:nth-child(2) { animation-delay: 0.16s; }
.memo-boot-spinner span:nth-child(3) { animation-delay: 0.32s; }
@keyframes memo-pulse {
  0%, 80%, 100% { opacity: 0.25; transform: scale(1); }
  40% { opacity: 1; transform: scale(1.4); }
}

/* --- Layout ------------------------------------------------------ */
.memo-app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 32px 20px calc(100px + env(safe-area-inset-bottom));
  position: relative;
}

.memo-header { margin-bottom: 28px; }
.memo-greeting {
  font-family: inherit;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 600;
  color: var(--memo-text);
  margin: 0;
}
.memo-greeting .memo-accent { color: var(--memo-accent); }
.memo-subtitle {
  font-size: 14px;
  color: var(--memo-text-soft);
  margin: 6px 0 0;
  font-weight: 400;
  letter-spacing: 0;
}

.memo-view { animation: memo-fade-in 0.3s var(--memo-ease); }
.memo-view.memo-hidden { display: none; }
@keyframes memo-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Capture ----------------------------------------------------- */
.memo-capture-card {
  background: var(--memo-card);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--memo-shadow);
  border: 1px solid var(--memo-border);
}
.memo-capture-input {
  width: 100%;
  font-family: inherit;
  font-size: 17px;
  line-height: 1.45;
  color: var(--memo-text);
  background: transparent;
  border: none;
  resize: none;
  outline: none;
  min-height: 60px;
  padding: 0;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.memo-capture-input::placeholder {
  color: var(--memo-text-faint);
  font-weight: 400;
}

.memo-tag-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--memo-border);
}
.memo-tag-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--memo-text-faint);
  margin-bottom: 10px;
  font-weight: 600;
}
.memo-tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.memo-tag-chip {
  background: var(--memo-bg-soft);
  border: 1px solid transparent;
  color: var(--memo-text-soft);
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s var(--memo-ease);
  letter-spacing: -0.005em;
}
.memo-tag-chip:hover {
  background: var(--memo-bg);
  border-color: var(--memo-border-strong);
  color: var(--memo-text);
}
.memo-tag-chip:active { transform: scale(0.96); }
.memo-tag-chip.memo-active {
  background: var(--memo-text);
  border-color: var(--memo-text);
  color: white;
}
.memo-tag-chip.memo-new {
  background: transparent;
  border: 1px dashed var(--memo-border-strong);
  color: var(--memo-text-soft);
}
.memo-tag-chip.memo-new:hover {
  border-color: var(--memo-text);
  color: var(--memo-text);
  background: transparent;
}
.memo-new-tag-input {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  padding: 10px 14px;
  border: 1px solid var(--memo-text);
  border-radius: 10px;
  background: white;
  outline: none;
  margin-top: 10px;
  display: none;
  color: var(--memo-text);
  font-weight: 500;
}
.memo-new-tag-input.memo-visible { display: block; }

/* Email toggle + Add button row */
.memo-bottom-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}
.memo-email-toggle {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  background: var(--memo-bg-soft);
  color: var(--memo-text);
  border: 1px solid var(--memo-border);
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s var(--memo-ease);
  padding: 0;
  position: relative;
}
.memo-email-toggle svg { width: 20px; height: 20px; }
.memo-email-toggle .memo-email-off { display: none; }
.memo-email-toggle.memo-on {
  background: var(--memo-text);
  border-color: var(--memo-text);
  color: white;
}
.memo-email-toggle.memo-on::after {
  content: '';
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  background: var(--memo-accent);
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--memo-text);
}
.memo-email-toggle.memo-off {
  background: var(--memo-card);
  color: var(--memo-text-faint);
  border-color: var(--memo-border);
}
.memo-email-toggle.memo-off .memo-email-on { display: none; }
.memo-email-toggle.memo-off .memo-email-off { display: block; }
.memo-email-toggle:active { transform: scale(0.95); }

.memo-btn-add {
  flex: 1;
  background: linear-gradient(180deg, #27272A 0%, #18181B 100%);
  color: white;
  border: none;
  padding: 0 20px;
  height: 48px;
  border-radius: 12px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s var(--memo-ease);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.08);
}
.memo-btn-add svg { width: 16px; height: 16px; transition: transform 0.2s var(--memo-ease); }
.memo-btn-add:hover svg { transform: translateX(2px); }
.memo-btn-add:active { transform: scale(0.99); }
.memo-btn-add:disabled {
  background: var(--memo-border);
  color: var(--memo-text-faint);
  cursor: not-allowed;
  box-shadow: none;
}

/* --- Section title (Récentes, etc.) ------------------------------ */
.memo-recent-section { margin-top: 36px; }
.memo-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.memo-section-title {
  font-family: inherit;
  font-size: 17px;
  color: var(--memo-text);
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.memo-section-count {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 11px;
  color: var(--memo-text-faint);
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* --- Notes ------------------------------------------------------- */
.memo-note-item {
  background: var(--memo-card);
  border: 1px solid var(--memo-border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 6px;
  display: flex;
  gap: 11px;
  align-items: flex-start;
  transition: all 0.2s var(--memo-ease);
  position: relative;
}
.memo-note-item:hover { border-color: var(--memo-border-strong); }
.memo-note-item.memo-done { opacity: 0.5; }
.memo-note-item.memo-done .memo-note-text { text-decoration: line-through; }
.memo-note-item.memo-pending { opacity: 0.55; }

.memo-note-check {
  width: 20px; height: 20px;
  border: 1.5px solid var(--memo-border-strong);
  border-radius: 6px;
  flex-shrink: 0;
  margin-top: 1px;
  cursor: pointer;
  transition: all 0.15s var(--memo-ease);
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
}
.memo-note-check:hover { border-color: var(--memo-text); }
.memo-note-check.memo-checked {
  background: var(--memo-text);
  border-color: var(--memo-text);
}
.memo-note-check.memo-checked::after {
  content: '';
  width: 5px; height: 9px;
  border-right: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(45deg) translate(-1px, -1px);
}

.memo-note-content { flex: 1; min-width: 0; }
.memo-note-text {
  font-size: 14.5px;
  color: var(--memo-text);
  line-height: 1.45;
  word-wrap: break-word;
  white-space: pre-wrap;
  font-weight: 450;
}
.memo-note-meta {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.memo-note-tag {
  display: inline-block;
  background: var(--memo-accent-soft);
  color: var(--memo-accent-dark);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 5px;
  letter-spacing: 0;
}
.memo-note-time {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 11px;
  color: var(--memo-text-faint);
  font-weight: 500;
}
.memo-note-delete {
  background: none;
  border: none;
  color: var(--memo-text-faint);
  cursor: pointer;
  padding: 4px 6px;
  font-size: 14px;
  align-self: flex-start;
  margin-top: -2px;
  transition: color 0.15s var(--memo-ease);
  opacity: 0.6;
}
.memo-note-delete:hover { color: var(--memo-error); opacity: 1; }

.memo-empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--memo-text-soft);
  font-size: 15px;
  line-height: 1.5;
}
.memo-empty-state .memo-ornament {
  display: block;
  margin: 0 auto 14px;
  width: 36px;
  height: 36px;
  opacity: 0.4;
}

/* --- List view --------------------------------------------------- */
.memo-tag-group {
  background: var(--memo-card);
  border: 1px solid var(--memo-border);
  border-radius: 14px;
  margin-bottom: 8px;
  overflow: hidden;
  transition: border-color 0.15s var(--memo-ease);
}
.memo-tag-group:hover { border-color: var(--memo-border-strong); }
.memo-tag-group-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}
.memo-tag-group-name {
  font-size: 15.5px;
  color: var(--memo-text);
  text-transform: capitalize;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.memo-tag-group-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}
.memo-tag-group-count {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 11px;
  background: var(--memo-accent-soft);
  color: var(--memo-accent-dark);
  padding: 3px 8px;
  border-radius: 5px;
  font-weight: 600;
  letter-spacing: 0;
}
.memo-tag-group-count.memo-empty {
  background: var(--memo-success-soft);
  color: var(--memo-success);
}
.memo-tag-group-arrow {
  color: var(--memo-text-faint);
  font-size: 12px;
  transition: transform 0.2s var(--memo-ease);
  display: flex;
  align-items: center;
}
.memo-tag-group-arrow svg { width: 14px; height: 14px; }
.memo-tag-group.memo-open .memo-tag-group-arrow { transform: rotate(90deg); }
.memo-tag-group-content {
  display: none;
  padding: 0 12px 12px;
}
.memo-tag-group.memo-open .memo-tag-group-content { display: block; }
.memo-tag-group .memo-note-item {
  background: var(--memo-bg-soft);
  margin-bottom: 4px;
  border-color: transparent;
}
.memo-tag-group .memo-note-item:hover { border-color: var(--memo-border); }

.memo-logout-row {
  margin-top: 36px;
  text-align: center;
}
.memo-logout-btn {
  background: none;
  border: none;
  color: var(--memo-text-faint);
  font-size: 12px;
  cursor: pointer;
  padding: 8px 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
  transition: color 0.15s var(--memo-ease);
}
.memo-logout-btn:hover { color: var(--memo-text); }

/* --- Prep view --------------------------------------------------- */
.memo-prep-header {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.memo-prep-tag-btn {
  background: var(--memo-card);
  border: 1px solid var(--memo-border);
  color: var(--memo-text-soft);
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s var(--memo-ease);
  text-transform: capitalize;
}
.memo-prep-tag-btn:hover { border-color: var(--memo-text); color: var(--memo-text); }
.memo-prep-tag-btn.memo-active {
  background: var(--memo-text);
  color: white;
  border-color: var(--memo-text);
}

.memo-prep-list {
  background: var(--memo-card);
  border-radius: 16px;
  padding: 24px 22px;
  border: 1px solid var(--memo-border);
  box-shadow: var(--memo-shadow);
}
.memo-prep-title {
  font-size: 24px;
  color: var(--memo-text);
  margin: 0 0 4px;
  text-transform: capitalize;
  font-weight: 600;
  letter-spacing: -0.025em;
}
.memo-prep-date {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 11px;
  color: var(--memo-text-faint);
  margin: 0 0 22px;
  letter-spacing: 0.02em;
  text-transform: lowercase;
}
.memo-prep-question {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--memo-border);
  font-size: 15px;
  line-height: 1.5;
}
.memo-prep-question:last-of-type { border-bottom: none; }
.memo-prep-question-num {
  font-family: 'Geist Mono', ui-monospace, monospace;
  color: var(--memo-accent);
  flex-shrink: 0;
  width: 22px;
  font-size: 14px;
  font-weight: 600;
  padding-top: 1px;
}
.memo-prep-actions {
  display: flex;
  gap: 8px;
  margin-top: 22px;
}
.memo-btn-secondary, .memo-btn-primary {
  flex: 1;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s var(--memo-ease);
  border: 1px solid var(--memo-border);
  letter-spacing: -0.005em;
}
.memo-btn-secondary {
  background: var(--memo-card);
  color: var(--memo-text);
}
.memo-btn-secondary:hover { border-color: var(--memo-text); }
.memo-btn-primary {
  background: var(--memo-text);
  color: white;
  border-color: var(--memo-text);
}
.memo-btn-primary:hover { background: #27272A; border-color: #27272A; }

/* --- Bottom nav -------------------------------------------------- */
.memo-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(250, 250, 250, 0.85);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--memo-border);
  padding: 8px 20px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-around;
  max-width: 480px;
  margin: 0 auto;
  z-index: 10;
}
.memo-nav-btn {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--memo-text-faint);
  font-size: 10.5px;
  font-weight: 500;
  transition: all 0.15s var(--memo-ease);
  letter-spacing: 0;
  min-width: 0;
}
.memo-nav-btn:hover { color: var(--memo-text-soft); }
.memo-nav-btn.memo-active { color: var(--memo-text); }
.memo-nav-icon { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; }
.memo-nav-icon svg { width: 21px; height: 21px; }

/* --- Toast ------------------------------------------------------- */
.memo-toast {
  position: fixed;
  bottom: calc(96px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--memo-text);
  color: white;
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.25s var(--memo-ease);
  pointer-events: none;
  z-index: 100;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  max-width: 88%;
  text-align: center;
  letter-spacing: -0.005em;
}
.memo-toast.memo-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.memo-toast.memo-error { background: var(--memo-error); }

/* --- Login required (visiteur non connecté) ---------------------- */
.memo-login-required {
  text-align: center;
  padding: 48px 24px;
  font-family: 'Geist', -apple-system, system-ui, sans-serif;
}
.memo-login-required p {
  color: #52525B;
  margin-bottom: 18px;
  font-size: 15px;
}
.memo-login-link {
  display: inline-block;
  background: #09090B;
  color: #FAFAFA;
  padding: 12px 22px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.005em;
  transition: opacity 0.15s ease;
}
.memo-login-link:hover { opacity: 0.9; color: #FAFAFA; }

/* =================================================================
 * Export view (v1.2)
 * ================================================================= */

/* On donne plus de place en bas pour la barre d'action fixe */
.memo-app-root.memo-export-active .memo-app { padding-bottom: calc(180px + env(safe-area-inset-bottom)); }

.memo-export-filters {
  margin-bottom: 18px;
}
.memo-export-filters-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--memo-text-faint);
  margin-bottom: 10px;
  font-weight: 600;
}
.memo-export-tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.memo-export-tag-chips .memo-tag-chip {
  /* hérite des styles existants */
}

.memo-export-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0 14px;
  border-bottom: 1px solid var(--memo-border);
  margin-bottom: 6px;
}
.memo-export-select-all {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--memo-text);
  letter-spacing: -0.005em;
}
.memo-export-check-box {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--memo-border-strong);
  border-radius: 5px;
  background: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s var(--memo-ease);
  flex-shrink: 0;
}
.memo-export-check-box.memo-checked,
.memo-export-check-box.memo-indeterminate {
  background: var(--memo-text);
  border-color: var(--memo-text);
}
.memo-export-check-box.memo-checked::after {
  content: '';
  width: 5px; height: 9px;
  border-right: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(45deg) translate(-1px, -1px);
}
.memo-export-check-box.memo-indeterminate::after {
  content: '';
  width: 8px; height: 2px;
  background: white;
  border-radius: 1px;
}
.memo-export-counter {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 11px;
  color: var(--memo-text-faint);
  letter-spacing: 0.02em;
  font-weight: 500;
}

.memo-export-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.memo-export-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 14px;
  background: var(--memo-card);
  border: 1px solid var(--memo-border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s var(--memo-ease);
  user-select: none;
}
.memo-export-row:hover { border-color: var(--memo-border-strong); }
.memo-export-row.memo-selected {
  background: var(--memo-bg-soft);
  border-color: var(--memo-text);
}

.memo-export-row-check {
  width: 18px; height: 18px;
  border: 1.5px solid var(--memo-border-strong);
  border-radius: 5px;
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  transition: all 0.12s var(--memo-ease);
}
.memo-export-row.memo-selected .memo-export-row-check {
  background: var(--memo-text);
  border-color: var(--memo-text);
}
.memo-export-row.memo-selected .memo-export-row-check::after {
  content: '';
  width: 5px; height: 9px;
  border-right: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(45deg) translate(-1px, -1px);
}

.memo-export-row-content { flex: 1; min-width: 0; }
.memo-export-row-text {
  font-size: 14px;
  line-height: 1.4;
  color: var(--memo-text);
  font-weight: 450;
  word-wrap: break-word;
}
.memo-export-row.memo-done .memo-export-row-text {
  color: var(--memo-text-faint);
  text-decoration: line-through;
}
.memo-export-row-meta {
  display: flex;
  gap: 8px;
  margin-top: 5px;
  align-items: center;
  flex-wrap: wrap;
}
.memo-export-row-tag {
  display: inline-block;
  background: var(--memo-accent-soft);
  color: var(--memo-accent-dark);
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: lowercase;
}
.memo-export-row-status {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 10.5px;
  color: var(--memo-text-faint);
  font-weight: 500;
}
.memo-export-row-status.memo-done {
  color: var(--memo-success);
}

.memo-export-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--memo-text-soft);
  font-size: 14px;
}

/* Barre d'action en bas (au-dessus de la nav) */
.memo-export-bar {
  position: fixed;
  bottom: calc(74px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 456px;
  background: var(--memo-card);
  border: 1px solid var(--memo-border);
  border-radius: 14px;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.04), 0 6px 24px rgba(0,0,0,0.08);
  padding: 10px 12px;
  display: none;
  align-items: center;
  gap: 10px;
  z-index: 20;
}
.memo-export-bar.memo-visible { display: flex; }

.memo-export-format {
  display: flex;
  gap: 2px;
  background: var(--memo-bg-soft);
  border-radius: 8px;
  padding: 3px;
  flex-shrink: 0;
}
.memo-export-format-btn {
  background: transparent;
  border: none;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--memo-text-soft);
  transition: all 0.15s var(--memo-ease);
  letter-spacing: -0.005em;
}
.memo-export-format-btn.memo-active {
  background: white;
  color: var(--memo-text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.memo-export-go {
  flex: 1;
  background: linear-gradient(180deg, #27272A 0%, #18181B 100%);
  color: white;
  border: none;
  padding: 0 16px;
  height: 42px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: -0.005em;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  transition: all 0.15s var(--memo-ease);
}
.memo-export-go:disabled {
  background: var(--memo-bg-soft);
  color: var(--memo-text-faint);
  cursor: not-allowed;
  box-shadow: none;
}
.memo-export-go-count {
  background: rgba(255,255,255,0.18);
  color: white;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 600;
}
.memo-export-go:disabled .memo-export-go-count {
  background: var(--memo-border);
  color: var(--memo-text-faint);
}

/* Iframe d'impression */
.memo-print-iframe {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  border: 0;
  background: white;
  z-index: 999999;
}

/* =================================================================
 * Catégories colorées (v1.3)
 * 12 couleurs ; chaque élément teinté utilise --tag-bg / --tag-fg.
 * ================================================================= */

.memo-color-rose    { --tag-bg: #FFE4E6; --tag-fg: #9F1239; }
.memo-color-orange  { --tag-bg: #FFEDD5; --tag-fg: #9A3412; }
.memo-color-amber   { --tag-bg: #FEF3C7; --tag-fg: #92400E; }
.memo-color-lime    { --tag-bg: #ECFCCB; --tag-fg: #3F6212; }
.memo-color-emerald { --tag-bg: #D1FAE5; --tag-fg: #065F46; }
.memo-color-teal    { --tag-bg: #CCFBF1; --tag-fg: #115E59; }
.memo-color-sky     { --tag-bg: #E0F2FE; --tag-fg: #075985; }
.memo-color-blue    { --tag-bg: #DBEAFE; --tag-fg: #1E40AF; }
.memo-color-indigo  { --tag-bg: #E0E7FF; --tag-fg: #3730A3; }
.memo-color-violet  { --tag-bg: #EDE9FE; --tag-fg: #5B21B6; }
.memo-color-pink    { --tag-bg: #FCE7F3; --tag-fg: #9D174D; }
.memo-color-slate   { --tag-bg: #E2E8F0; --tag-fg: #334155; }

/* Tag chips colorés (capture, export, prep) */
.memo-tag-chip[class*="memo-color-"] {
  background: var(--tag-bg);
  color: var(--tag-fg);
  border-color: transparent;
}
.memo-tag-chip[class*="memo-color-"]:hover {
  background: var(--tag-bg);
  border-color: var(--tag-fg);
  color: var(--tag-fg);
}
.memo-tag-chip[class*="memo-color-"].memo-active {
  background: var(--tag-fg);
  border-color: var(--tag-fg);
  color: white;
}

/* Pastille couleur sur une note */
.memo-note-tag[class*="memo-color-"] {
  background: var(--tag-bg);
  color: var(--tag-fg);
}

/* Pastille de comptage dans la vue Toutes */
.memo-tag-group-count[class*="memo-color-"] {
  background: var(--tag-bg);
  color: var(--tag-fg);
}

/* En-tête de groupe : petite pastille colorée à gauche */
.memo-tag-group-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tag-fg, var(--memo-text-faint));
  margin-right: 9px;
  flex-shrink: 0;
}
.memo-tag-group-name-wrap {
  display: flex;
  align-items: center;
}

/* Vue Préparer : boutons colorés */
.memo-prep-tag-btn[class*="memo-color-"] {
  background: var(--tag-bg);
  border-color: transparent;
  color: var(--tag-fg);
}
.memo-prep-tag-btn[class*="memo-color-"]:hover {
  background: var(--tag-bg);
  border-color: var(--tag-fg);
  color: var(--tag-fg);
}
.memo-prep-tag-btn[class*="memo-color-"].memo-active {
  background: var(--tag-fg);
  border-color: var(--tag-fg);
  color: white;
}

/* Vue Préparer : titre coloré */
.memo-prep-title[class*="memo-color-"] {
  color: var(--tag-fg);
}

/* Numéros des questions colorés en accord avec le tag actif */
.memo-prep-question-num[class*="memo-color-"] {
  color: var(--tag-fg);
}

/* Pastille tag dans la vue Export */
.memo-export-row-tag[class*="memo-color-"] {
  background: var(--tag-bg);
  color: var(--tag-fg);
}

/* Indication visuelle "appui long détecté" */
.memo-tag-chip.memo-pressing,
.memo-tag-group-header.memo-pressing,
.memo-prep-tag-btn.memo-pressing {
  transform: scale(0.96);
  transition: transform 0.15s var(--memo-ease);
}

/* =================================================================
 * Modal sélecteur de couleur
 * ================================================================= */

.memo-color-modal {
  position: fixed;
  inset: 0;
  z-index: 999998;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: memo-color-fade-in 0.18s var(--memo-ease);
}
@media (min-width: 600px) {
  .memo-color-modal { align-items: center; }
}

.memo-color-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.32);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.memo-color-modal-card {
  position: relative;
  background: var(--memo-card);
  width: 100%;
  max-width: 420px;
  border-radius: 18px 18px 0 0;
  padding: 18px 18px calc(22px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(0,0,0,0.18);
  animation: memo-color-slide-up 0.22s var(--memo-ease);
}
@media (min-width: 600px) {
  .memo-color-modal-card {
    border-radius: 18px;
    margin: 0 16px;
    padding: 20px 20px 22px;
  }
}

@keyframes memo-color-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes memo-color-slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.memo-color-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.memo-color-modal-pill {
  display: inline-block;
  background: var(--tag-bg, var(--memo-bg-soft));
  color: var(--tag-fg, var(--memo-text));
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  letter-spacing: -0.005em;
  text-transform: lowercase;
  transition: all 0.18s var(--memo-ease);
}
.memo-color-modal-close {
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--memo-text-faint);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s var(--memo-ease);
}
.memo-color-modal-close:hover {
  color: var(--memo-text);
  background: var(--memo-bg-soft);
}
.memo-color-modal-close svg { width: 18px; height: 18px; }

.memo-color-modal-swatches {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.memo-color-swatch {
  aspect-ratio: 1;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.18s var(--memo-ease);
  position: relative;
  padding: 0;
}
.memo-color-swatch:hover {
  transform: scale(1.08);
}
.memo-color-swatch.memo-current {
  box-shadow: 0 0 0 2px white, 0 0 0 4px var(--memo-text);
}
.memo-color-swatch.memo-current::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 12px;
  border-right: 2px solid white;
  border-bottom: 2px solid white;
  transform: translate(-50%, -65%) rotate(45deg);
  filter: drop-shadow(0 0 1px rgba(0,0,0,0.3));
}

.memo-color-modal-hint {
  text-align: center;
  font-size: 11px;
  color: var(--memo-text-faint);
  letter-spacing: 0.01em;
  padding-top: 6px;
  border-top: 1px solid var(--memo-border);
}

/* =================================================================
 * Modal d'édition d'une note (v1.4)
 * ================================================================= */

.memo-edit-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: memo-color-fade-in 0.18s var(--memo-ease);
}
@media (min-width: 600px) {
  .memo-edit-modal { align-items: center; }
}

.memo-edit-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.34);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.memo-edit-modal-card {
  position: relative;
  background: var(--memo-card);
  width: 100%;
  max-width: 520px;
  border-radius: 18px 18px 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(0,0,0,0.18);
  animation: memo-color-slide-up 0.22s var(--memo-ease);
  max-height: 92vh;
  overflow-y: auto;
}
@media (min-width: 600px) {
  .memo-edit-modal-card {
    border-radius: 18px;
    margin: 0 16px;
    padding: 22px 22px 22px;
    max-height: 80vh;
  }
}

.memo-edit-modal-head h3 {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--memo-ink);
}

.memo-edit-modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.memo-edit-modal-textarea {
  width: 100%;
  min-height: 86px;
  border: 1px solid var(--memo-rule);
  background: var(--memo-paper);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
  color: var(--memo-ink);
  resize: vertical;
  transition: border-color 0.15s var(--memo-ease), box-shadow 0.15s var(--memo-ease);
}
.memo-edit-modal-textarea:focus {
  outline: none;
  border-color: var(--memo-accent);
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.12);
}

.memo-edit-modal-section-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--memo-ink-soft);
  margin-bottom: -6px;
}

.memo-edit-modal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.memo-edit-modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  justify-content: flex-end;
}

.memo-edit-modal-actions .memo-btn-primary,
.memo-edit-modal-actions .memo-btn-secondary {
  flex: 1;
}
@media (min-width: 600px) {
  .memo-edit-modal-actions .memo-btn-primary,
  .memo-edit-modal-actions .memo-btn-secondary {
    flex: 0 0 auto;
    min-width: 130px;
  }
}

/* Indique que la zone de texte d'une note est tappable pour éditer */
.memo-note-content[data-action="edit"] {
  cursor: pointer;
}
.memo-note-content[data-action="edit"]:hover .memo-note-text {
  color: var(--memo-accent);
}

/* Plusieurs badges côte à côte : espacement horizontal */
.memo-note-meta .memo-note-tag + .memo-note-tag,
.memo-export-row-meta .memo-export-row-tag + .memo-export-row-tag {
  margin-left: 4px;
}
