:root {
  --abi: #F5B301;        /* jaune abeille */
  --abi-soft: #FFE9A8;
  --mia: #8B5CF6;        /* violet papillon */
  --mia-soft: #DDD0FB;
  --flo: #22C55E;        /* vert */
  --flo-d: #16A34A;
  --anais: #3B82F6;      /* bleu */
  --anais-d: #2563EB;
  --ink: #2A2540;
  --ink-soft: #6B6486;
  --card: rgba(255,255,255,0.92);
  --radius: 18px;
  --shadow: 0 8px 30px rgba(70,40,120,0.18);
  --tab-h: 68px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  color: var(--ink);
  min-height: 100vh;
  overflow: hidden;    /* l'app est fixed : le body ne doit JAMAIS scroller (piège iOS) */
  /* Fond sombre bleu-vert + auras : jaune (Abi) en haut-gauche, violet (Mia) en bas-droite */
  background:
    radial-gradient(1100px 900px at 5% 5%, rgba(255,205,0,1), rgba(255,195,0,0.45) 45%, transparent 72%),
    radial-gradient(1050px 900px at 96% 94%, rgba(162,89,255,0.95), rgba(150,90,255,0.32) 46%, transparent 70%),
    radial-gradient(700px 550px at 88% 4%, rgba(20,184,166,0.16), transparent 60%),
    linear-gradient(155deg, #081418 0%, #0A0F20 55%, #0E0B1E 100%);
  background-attachment: fixed;
}

.hidden { display: none !important; }

/* ---------- Login ---------- */
.login-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  background: rgba(16,20,38,0.55);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 26px;
  padding: 38px 30px;
  width: 100%; max-width: 360px;
  text-align: center;
  box-shadow: 0 18px 50px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.10);
}
.login-logo { width: 84px; height: 84px; border-radius: 22px; box-shadow: 0 10px 30px rgba(139,92,246,0.4); }
.login-card h1 {
  font-family: 'Caveat', cursive; font-size: 52px; line-height: 1; margin-top: 12px;
  background: linear-gradient(110deg, #FFD34D, #C9A9FF);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.login-sub { color: rgba(240,236,255,0.55); margin: 4px 0 24px; }
.login-card input {
  width: 100%; padding: 15px 16px; font-size: 17px;
  background: rgba(255,255,255,0.08); color: #F2EEFF;
  border: 1px solid rgba(255,255,255,0.18); border-radius: 14px; outline: none;
  margin-bottom: 12px; text-align: center;
}
.login-card input::placeholder { color: rgba(240,236,255,0.4); }
.login-card input:focus { border-color: rgba(139,92,246,0.8); box-shadow: 0 0 0 3px rgba(139,92,246,0.25); }
.login-card button {
  width: 100%; padding: 15px; font-size: 17px; font-weight: 700;
  color: #fff; border: none; border-radius: 14px; cursor: pointer;
  background: linear-gradient(135deg, var(--abi), var(--mia));
  box-shadow: 0 8px 24px rgba(139,92,246,0.4);
}
.login-error { color: #FB7185; margin-top: 12px; min-height: 20px; font-size: 14px; }

/* ---------- App shell ---------- */
/* App clouée aux 4 bords du viewport (fixed) : le body ne scrolle jamais,
   le header reste en haut, le dock en bas, quel que soit l'état de la barre
   d'URL iOS. Seul le contenu interne (grille, bloc-notes) scrolle. */
.app {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; overflow: hidden;
}

.views { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 16px; padding-bottom: calc(var(--tab-h) + 20px); }
.view { display: none; flex: 1; width: 100%; max-width: 1000px; margin: 0 auto; flex-direction: column; min-height: 0; }
.view.active { display: flex; }

/* ---------- Tab bar (mobile) ---------- */
.tabbar {
  position: fixed; left: 14px; right: 14px; z-index: 30;
  bottom: calc(12px + env(safe-area-inset-bottom));
  height: var(--tab-h);
  max-width: 520px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-around;
  background: rgba(16,20,38,0.55);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 28px;
  box-shadow: 0 12px 38px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.10);
}
.tab {
  border: none; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: rgba(240,236,255,0.55); font-size: 11px; font-weight: 700;
  padding: 6px 10px; border-radius: 14px; transition: transform .12s, background .15s;
}
.tab-ico { font-size: 22px; line-height: 1; }

/* Pastille "non lu" façon badge iOS, discrète */
.tab { position: relative; }
.pbtn { position: relative; }
.tab.has-new::after, .pbtn.has-new::after {
  content: ''; position: absolute; top: 3px; right: 7px;
  width: 9px; height: 9px; border-radius: 50%;
  background: #FB4E4E;
  box-shadow: 0 0 0 2px rgba(16,20,38,0.85), 0 0 8px rgba(251,78,78,0.7);
}
/* Onglet actif : pastille pleine bien visible, teintée par personne */
.tab.active {
  color: var(--ink); background: #fff; font-weight: 800;
  box-shadow: 0 4px 12px rgba(70,40,120,0.22);
  transform: translateY(-2px);
}
.tab[data-tab="flo"].active   { color: var(--flo-d);   background: #DDF7E7; box-shadow: 0 4px 12px rgba(22,163,74,0.30); }
.tab[data-tab="anais"].active { color: var(--anais-d); background: #DFEBFF; box-shadow: 0 4px 12px rgba(37,99,235,0.30); }
.tab[data-tab="mia"].active   { color: var(--mia);     background: #ECE2FE; box-shadow: 0 4px 12px rgba(139,92,246,0.32); }
.tab[data-tab="abi"].active   { color: #A87908;        background: #FFF0C4; box-shadow: 0 4px 12px rgba(245,179,1,0.35); }

.tab.tab-center, .tab.tab-center.active {
  width: 52px; height: 52px; margin: 0; padding: 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 3px solid transparent;
  background: linear-gradient(#fff, #fff) padding-box,
              linear-gradient(135deg, var(--abi), var(--mia)) border-box;
  box-shadow: 0 4px 14px rgba(70,40,120,0.25);
}
.tab-center .tab-cal { width: 27px; height: 27px; display: block; }
.tab-center:hover { transform: scale(1.06); }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px;
}

/* ---------- Agenda ---------- */
.agenda-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.agenda-month {
  flex: 1; text-align: center; font-size: 20px; font-weight: 800;
  text-transform: capitalize; cursor: pointer; min-width: 0;
  color: #F2EEFF; text-shadow: 0 2px 12px rgba(0,0,0,0.35);
}
.agenda-arrow {
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.10);
  backdrop-filter: blur(12px);
  width: 42px; height: 42px; border-radius: 13px; font-size: 22px; line-height: 1; cursor: pointer;
  color: #F2EEFF; flex: none; display: flex; align-items: center; justify-content: center;
}

/* ---------- Palette de pinceaux (barre en verre, comme le dock) ---------- */
.paint-bar {
  display: flex; align-items: center; gap: 2px; margin: 2px 2px 12px;
  background: rgba(255,255,255,0.09);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 999px; padding: 5px 6px;
  box-shadow: 0 8px 26px rgba(0,0,0,0.35);
  overflow-x: auto; scrollbar-width: none;
}
.paint-bar::-webkit-scrollbar { display: none; }
.paint-flex { flex: 1; min-width: 6px; }
/* Séparateur de groupes d'outils */
.tsep { flex: none; width: 1px; height: 22px; background: rgba(255,255,255,0.18); margin: 0 3px; }

/* Thème "pastilles de verre, traits bold" (planche #4 + main #1/#3 + nuancier #26) */
.brush {
  flex: none; border: none; cursor: pointer; border-radius: 50%;
  width: 38px; height: 38px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.14);
  transition: background .15s, box-shadow .15s, opacity .15s;
}
.brush.tool { color: #F6F3FF; }
.brush.tool svg { width: 19px; height: 19px; stroke-width: 2.4; display: block; }
.brush.off { opacity: .3; pointer-events: none; }
/* Gélules nommées : les pinceaux de base Flo / Anaïs */
.brush.pill {
  width: auto; padding: 0 14px; border-radius: 999px;
  font-size: 13px; font-weight: 800; color: #fff;
  border: none; opacity: .88;
}
.brush.pill.flo   { background: var(--flo); }
.brush.pill.anais { background: var(--anais); }
/* Nuancier : liseré de la couleur active quand un hexa est choisi */
.brush.multi.sel { box-shadow: inset 0 0 0 2px var(--curcol, #fff), 0 0 10px rgba(255,255,255,0.18); }
/* Sélection : halo de verre doux (rien qui déborde) */
.brush.sel {
  background: rgba(255,255,255,0.26);
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.6), 0 0 10px rgba(255,255,255,0.15);
}
.brush.pill.sel {
  opacity: 1;
  box-shadow: inset 0 0 0 2.5px rgba(255,255,255,0.9), inset 0 0 10px rgba(255,255,255,0.55);
}

/* ---------- Vues trimestre / année (mini-mois) ---------- */
.calendar.scope-wide .cal-scroll { padding: 8px; }
.mini-list.wide { display: flex; flex-direction: column; gap: 14px; }
.mini-month {
  background: var(--card); border-radius: 14px; padding: 8px 8px 10px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.16); cursor: pointer;
}
.mini-title { font-size: 15px; font-weight: 800; text-transform: capitalize; color: var(--ink); margin: 2px 4px 6px; }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.mini-day { min-height: 28px; display: flex; flex-direction: column; align-items: center; padding-top: 2px; }
.mini-day.out { visibility: hidden; }
.mini-day b { font-size: 12px; font-weight: 600; color: var(--ink); line-height: 1; }
.mini-day.today b { background: var(--mia); color: #fff; border-radius: 50%; width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; }
.mini-bars { display: flex; flex-direction: column; gap: 1px; width: 80%; margin-top: 2px; }
.mini-bars span { height: 3px; border-radius: 2px; }

/* ---------- Bandes d'événements (façon agenda iPhone) ---------- */
.evt-layer { position: absolute; inset: 0; z-index: 4; pointer-events: none; transition: opacity .15s; }
.evt-band {
  position: absolute; pointer-events: auto; cursor: pointer;
  display: flex; align-items: center; padding: 0 7px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-family: 'Caveat', cursive; font-weight: 700; line-height: 1;
  color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.35);
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.evt-band.tmp { opacity: .75; pointer-events: none; }
.calendar.painting .evt-band { pointer-events: none; }
.evt-more {
  position: absolute; pointer-events: none;
  font-size: 10px; font-weight: 800; color: var(--ink-soft);
}

/* Fiche événement */
#evt-colors {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px;
  margin-bottom: 14px;
}
#evt-colors .pill-swatch {
  grid-column: span 3; aspect-ratio: auto; height: 38px; border-radius: 999px;
  color: #fff; font-weight: 800; font-size: 14px; border: none; cursor: pointer;
}
#evt-colors .pill-swatch.flo   { background: var(--flo); }
#evt-colors .pill-swatch.anais { background: var(--anais); }
.evt-when {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 8px; align-items: center;
  margin-bottom: 16px;
}
.evt-when label { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.evt-when input[type="date"], .evt-when select {
  border: 2px solid #E9E4F5; border-radius: 10px; padding: 9px 8px;
  font-size: 15px; font-family: inherit; outline: none; background: #fff; color: var(--ink);
}
.evt-when input[type="date"]:focus, .evt-when select:focus { border-color: var(--mia); }
.evt-recur-row {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 12px 14px; margin-bottom: 16px;
  border: 2px solid #E9E4F5; border-radius: 14px; font-size: 15px; font-weight: 600;
}
.evt-recur-row input { width: 22px; height: 22px; accent-color: var(--mia); flex: none; }
.evt-recur-row small { color: var(--ink-soft); font-weight: 400; }
.evt-actions { display: flex; gap: 10px; }

/* ---------- Modale changelog ---------- */
#changelog-modal .modal-card { max-width: 440px; }
#changelog-modal .modal-head h3 { text-transform: none; }
.chlog-entry { margin-bottom: 16px; }
.chlog-entry:last-child { margin-bottom: 4px; }
.chlog-ver { font-size: 13px; font-weight: 800; color: var(--mia); margin-bottom: 6px; }
.chlog-entry ul { list-style: none; padding: 0; }
.chlog-entry li {
  font-size: 15px; line-height: 1.5; padding: 5px 0 5px 4px;
  border-left: 3px solid #EFE9FB; padding-left: 12px; margin-bottom: 4px;
}
#evt-delete {
  flex: 1; border: 2px solid #FBD5DC; background: #FFF1F3; color: #E11D48;
  border-radius: 14px; font-size: 15px; font-weight: 700; cursor: pointer; padding: 13px;
}
.evt-actions .modal-save { flex: 1.4; width: auto; padding: 13px; }


/* Grille de la modale couleur */
#color-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px;
  padding: 4px 2px 8px;
}
.swatch {
  width: 100%; aspect-ratio: 1; border: none; border-radius: 50%;
  cursor: pointer; box-shadow: 0 2px 6px rgba(40,20,70,0.25);
  transition: transform .1s;
}
.swatch:hover { transform: scale(1.12); }
.swatch.sel {
  box-shadow: inset 0 0 0 3px #fff, inset 0 0 8px rgba(255,255,255,0.7), 0 2px 6px rgba(40,20,70,0.25);
}

/* Cloche notifications : allumée quand les push sont actives */
.brush.bell.on {
  opacity: 1; color: #FFD34D;
  filter: drop-shadow(0 0 6px rgba(255,211,77,0.6));
}

/* Toast d'information */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + 30px);
  transform: translate(-50%, 16px); opacity: 0;
  z-index: 90; max-width: 86vw;
  background: rgba(16,20,38,0.92); color: #F2EEFF;
  border: 1px solid rgba(255,255,255,0.16);
  padding: 12px 18px; border-radius: 14px; font-size: 14px; font-weight: 600;
  text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.45);
  transition: opacity .3s, transform .3s;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* En mode peinture, le curseur le signale et le tap n'ouvre plus le modal */
.calendar.painting .cal-cell { cursor: crosshair; }

.calendar { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.cal-scroll {
  flex: 1; min-height: 0; overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y;
  scrollbar-width: none;            /* la scrollbar clignotait pendant le pinch */
}
.cal-scroll::-webkit-scrollbar { display: none; }
.cal-inner { min-width: 100%; min-height: 100%; display: flex; flex-direction: column; }
.cal-weekdays, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-grid { flex: 1; grid-auto-rows: minmax(58px, 1fr); position: relative; }

/* Étiquettes manuscrites au-dessus des traits */
.cal-labels { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.cal-label {
  position: absolute;
  transform: translate(-50%, -100%) rotate(-4deg);
  font-family: 'Caveat', cursive;
  font-size: calc(17px * clamp(1, var(--z, 1) / 1.5, 2.4));
  font-weight: 700; line-height: 1; white-space: nowrap;
  text-shadow: 0 1px 0 rgba(255,255,255,0.85), 0 0 6px rgba(255,255,255,0.6);
}
/* Nom de la ligne du bas (fille séparée) : sous la barre */
.cal-label.below { transform: translate(-50%, 2px) rotate(-4deg); }
.cal-weekdays { position: sticky; top: 0; z-index: 3; background: #EFE9FB; }
.cal-weekdays div {
  text-align: center; padding: 9px 0; font-size: 11px; font-weight: 700;
  color: var(--mia); text-transform: uppercase; letter-spacing: .5px;
}
.cal-cell {
  min-height: 76px; border-top: 1px solid #DDD5EE; border-left: 1px solid #DDD5EE;
  padding: 4px 4px 5px; cursor: pointer; position: relative;
  display: flex; flex-direction: column; gap: 3px;
}
.cal-cell:nth-child(7n+1) { border-left: none; }
.cal-cell.weekend { background: #F6F3FC; }
.cal-cell.out { opacity: .38; }
.cal-cell.today .cal-daynum,
.cal-cell.today.weekend .cal-daynum {
  background: var(--mia); color: #fff;
  box-shadow: 0 2px 8px rgba(139,92,246,0.45);
}
.cal-daynum {
  font-size: 12px; font-weight: 700; width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center; border-radius: 50%;
}
.cal-cell.weekend .cal-daynum { color: var(--anais-d); }

.bars { display: flex; flex-direction: column; gap: 3px; margin-top: auto; }
.bar-row { display: flex; align-items: center; gap: 4px; }
.bar-ico { font-size: 10px; width: 12px; text-align: center; }
.bar { flex: 1; height: 9px; border-radius: 5px; overflow: hidden; display: flex; }
/* Jonction intercellule : le trait continue par-dessus la bordure de la case */
.bar.join-l { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -5px; }
.bar.join-r { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: -5px; }
.bar .half { flex: 1; }
.half.flo { background: var(--flo); }
.half.anais { background: var(--anais); }
.half.violet { background: #8B5CF6; }
.half.rose { background: #F472B6; }
.half.orange { background: #F97316; }
.half.turquoise { background: #14B8A6; }
.half.none { background: #E7E2F2; }
/* Emojis des notes : visibles dézoomé, en haut à droite de la case */
.cal-emojis {
  position: absolute; top: 3px; right: 4px; max-width: 62%;
  font-size: 12px; line-height: 1.15; text-align: right; word-break: break-all;
  pointer-events: none;
}
.calendar.zoomed .cal-emojis { display: none; }
/* Notes visibles seulement quand on a zoomé assez */
.cal-notes { display: none; min-height: 0; overflow: hidden; }
.calendar.zoomed .cal-notes { display: block; }
/* Le texte grossit avec le zoom (--z), plafonné pour rester propre */
.cal-note {
  font-size: calc(10.5px * clamp(1, var(--z, 1) / 1.6, 3.2));
  line-height: 1.3; font-weight: 600; color: var(--ink);
  background: #FFF3E4; border-radius: 6px; padding: 2px 5px; margin: 2px 0;
  word-break: break-word;
}
.calendar.zoomed .cal-daynum {
  font-size: calc(12px * clamp(1, var(--z, 1) / 1.6, 2.4));
  width: auto; min-width: 22px; height: auto; padding: 1px 6px; border-radius: 999px;
}
.calendar.zoomed .bar { height: calc(9px * clamp(1, var(--z, 1) / 1.6, 2.2)); }
.calendar.zoomed .bar-ico { font-size: calc(10px * clamp(1, var(--z, 1) / 1.6, 2.2)); width: auto; }

/* ---------- Modale : plein écran sur mobile, centrée sur PC ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(40,20,70,0.45); }
.modal-card {
  position: relative; background: #fff; width: 100%; max-width: 460px;
  border-radius: 22px; padding: 20px; box-shadow: var(--shadow);
  max-height: 88vh; overflow-y: auto;
}
@media (max-width: 899px) {
  #day-modal .modal-card {
    max-width: none; height: 100%; max-height: none; border-radius: 0;
    padding-top: max(20px, env(safe-area-inset-top));
    display: flex; flex-direction: column;
  }
  #day-modal #notes-list { flex: 1; overflow-y: auto; }
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h3 { font-size: 18px; text-transform: capitalize; }

/* Boutons croix : dessinés en CSS (deux barres), centrage parfait garanti */
.modal-close, .note-del {
  position: relative; border: none; cursor: pointer; font-size: 0;
  display: flex; align-items: center; justify-content: center; flex: none;
  transition: background .15s;
}
.modal-close::before, .modal-close::after,
.note-del::before, .note-del::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 12px; height: 2px; border-radius: 2px; background: currentColor;
}
.modal-close::before, .note-del::before { transform: translate(-50%, -50%) rotate(45deg); }
.modal-close::after,  .note-del::after  { transform: translate(-50%, -50%) rotate(-45deg); }
.modal-close {
  width: 34px; height: 34px; border-radius: 50%;
  background: #F1EDFA; color: var(--ink-soft);
}
.modal-close:hover { background: #E7DFF7; color: var(--ink); }

.child-block { border: 2px solid #F0ECF9; border-radius: 16px; padding: 14px; margin-bottom: 14px; }
.child-block h4 { font-size: 15px; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.seg-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.seg-row > span { width: 52px; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.seg-choices { display: flex; gap: 6px; flex: 1; }
.seg-choices button {
  flex: 1; padding: 9px 4px; border: 2px solid #E9E4F5; background: #fff;
  border-radius: 11px; font-size: 12px; font-weight: 700; cursor: pointer; color: var(--ink-soft);
}
.seg-choices button.sel[data-who="flo"]   { background: var(--flo); border-color: var(--flo); color: #fff; }
.seg-choices button.sel[data-who="anais"] { background: var(--anais); border-color: var(--anais); color: #fff; }
.seg-choices button.sel[data-who="base"]  { background: var(--ink-soft); border-color: var(--ink-soft); color: #fff; }
/* Notes emoji + texte de la modale jour */
.note-row { display: flex; gap: 8px; margin-bottom: 10px; align-items: center; }
/* Tuile emoji = un vrai input : tap → clavier natif du téléphone.
   ⚠️ font-size ≥ 16px obligatoire sur les inputs, sinon iOS zoome la page au focus. */
.note-emoji {
  flex: none; width: 50px; height: 48px; font-size: 22px; text-align: center;
  border: 2px solid #E9E4F5; border-radius: 12px; background: #fff;
  outline: none; padding: 0; caret-color: transparent;
}
.note-emoji:focus { border-color: var(--mia); }
.note-text {
  flex: 1; min-width: 0; border: 2px solid #E9E4F5; border-radius: 12px;
  padding: 12px; font-size: 16px; font-family: inherit; outline: none;
}
.note-text:focus { border-color: var(--mia); }
#emoji-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px;
  background: #F8F5FE; border-radius: 14px; padding: 8px; margin-bottom: 10px;
}
#emoji-grid button {
  border: none; background: transparent; font-size: 21px; cursor: pointer;
  height: 40px; border-radius: 10px;
}
#emoji-grid button:hover { background: #ECE5FA; }
.note-del {
  width: 34px; height: 34px; border-radius: 50%;
  background: #F6F2FC; color: var(--ink-soft);
}
.note-del::before, .note-del::after { width: 10px; }
.note-del:hover { background: #F3E7EA; color: #E11D48; }
.no-notes { color: var(--ink-soft); font-size: 14px; margin: 4px 0 14px; }
.add-note {
  width: 100%; padding: 12px; margin-bottom: 10px; cursor: pointer;
  border: 2px dashed #D9CFF2; border-radius: 14px; background: transparent;
  color: var(--mia); font-size: 15px; font-weight: 700;
}
.modal-card-small { max-width: 400px; border-radius: 22px; margin: 0 16px; }
.modal-card-small h3 { text-transform: none; }
.name-input {
  width: 100%; border: 2px solid #E9E4F5; border-radius: 12px;
  padding: 13px 14px; font-size: 16px; margin-bottom: 14px; outline: none;
  font-family: inherit;
}
.name-input:focus { border-color: var(--mia); }
.modal-save {
  width: 100%; padding: 14px; border: none; border-radius: 14px; cursor: pointer;
  font-size: 16px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--abi), var(--mia));
}

/* ---------- Bloc-notes (contenteditable) ---------- */
.pad-wrap { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.save-dot {
  position: absolute; top: 8px; right: 10px; z-index: 5;
  font-size: 13px; color: var(--flo-d); width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: rgba(255,255,255,0.7); backdrop-filter: blur(4px);
  pointer-events: none;
}
.save-dot.saving { color: var(--ink-soft); }

.notepad {
  flex: 1; min-height: 220px; overflow-y: auto; outline: none;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; font-size: 15px; line-height: 1.65; color: var(--ink);
  -webkit-user-select: text; user-select: text;
}
.notepad:empty::before { content: attr(data-ph); color: var(--ink-soft); }
.notepad:focus { box-shadow: 0 0 0 2px var(--mia), var(--shadow); }
.notepad h1, .notepad h2, .notepad h3 { margin: 14px 0 8px; line-height: 1.25; }
.notepad h1 { font-size: 22px; } .notepad h2 { font-size: 19px; } .notepad h3 { font-size: 17px; }
.notepad ul, .notepad ol { padding-left: 22px; margin: 8px 0; }
.notepad p { margin: 7px 0; }
.notepad a { color: var(--mia); }
.notepad blockquote {
  border-left: 3px solid var(--mia); padding-left: 12px; margin: 8px 0; color: var(--ink-soft);
}

/* Tooltip de mise en forme à la sélection */
.sel-tip {
  position: fixed; z-index: 100; display: flex; gap: 2px;
  background: #2A2540; border-radius: 12px; padding: 4px;
  box-shadow: 0 8px 24px rgba(20,10,40,0.35);
  transform: translate(-50%, -100%);
}
.sel-tip::after {
  content: ''; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: #2A2540; border-bottom: 0;
}
.sel-tip button {
  border: none; background: transparent; color: #fff; cursor: pointer;
  font-size: 13px; font-weight: 600; padding: 7px 10px; border-radius: 8px; white-space: nowrap;
}
.sel-tip button:hover { background: rgba(255,255,255,0.16); }
.sel-tip button.b { font-weight: 800; }
.sel-tip button.i { font-style: italic; }
.sel-tip button.s { text-decoration: line-through; }
.sel-tip .sep { width: 1px; background: rgba(255,255,255,0.18); margin: 4px 2px; }

/* ---------- Barre de personnes (PC) ---------- */
.person-bar {
  display: flex; gap: 8px; margin-bottom: 12px; flex: none;
  background: rgba(16,20,38,0.55);
  backdrop-filter: blur(12px) saturate(1.4);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 18px; padding: 6px;
  box-shadow: 0 8px 26px rgba(0,0,0,0.35);
}
.pbtn {
  flex: 1; border: none; background: transparent; cursor: pointer;
  font-size: 14px; font-weight: 700; color: rgba(240,236,255,0.55);
  padding: 11px 6px; border-radius: 13px; transition: background .15s, color .15s;
  white-space: nowrap;
}
.pbtn.active { color: var(--ink); background: #fff; box-shadow: 0 3px 10px rgba(70,40,120,0.18); }
.pbtn[data-tab="flo"].active   { color: var(--flo-d);   background: #DDF7E7; }
.pbtn[data-tab="mia"].active   { color: var(--mia);     background: #ECE2FE; }
.pbtn[data-tab="abi"].active   { color: #A87908;        background: #FFF0C4; }
.pbtn[data-tab="anais"].active { color: var(--anais-d); background: #DFEBFF; }

/* ---------- PC : calendrier à droite, personne sélectionnée à gauche ---------- */
@media (min-width: 900px) {
  .tabbar { display: none; }
  #views {
    display: grid;
    grid-template-columns: 1fr 1.25fr;
    gap: 16px; padding: 16px; max-width: 1700px; margin: 0 auto;
    width: 100%; height: 100%; min-height: 0; overflow: hidden;
  }
  .left-pane { display: flex; flex-direction: column; min-height: 0; }
  /* Agenda toujours affiché à droite ; à gauche, la personne sélectionnée */
  .view[data-view="agenda"] { display: flex !important; max-width: none; margin: 0; min-height: 0; }
  .view.person-active { display: flex !important; max-width: none; margin: 0; min-height: 0; flex: 1; }
  .view:not([data-view="agenda"]) .notepad { font-size: 14px; }
  .cal-grid { grid-auto-rows: minmax(52px, 1fr); }
}
@media (max-width: 899px) {
  .person-bar { display: none; }
  .left-pane { display: contents; }
  /* Plein écran bord à bord ; le contenu glisse sous le dock en verre.
     Hauteurs explicites : WebKit (iOS) rate parfois les flex:1 imbriqués. */
  .views { padding: 0; height: 100%; }
  .view { padding: 0; max-width: none; height: 100%; }
  /* Mobile : dominante VIOLETTE (les icônes claires ressortent) + touche de jaune */
  body {
    background:
      radial-gradient(420px 340px at 100% 0%, rgba(255,200,0,0.55), rgba(255,195,0,0.15) 55%, transparent 75%),
      radial-gradient(900px 750px at 0% 20%, rgba(150,90,255,0.65), rgba(150,90,255,0.22) 52%, transparent 76%),
      radial-gradient(1000px 900px at 85% 100%, rgba(162,89,255,0.85), rgba(150,90,255,0.3) 50%, transparent 72%),
      linear-gradient(155deg, #0E0A20 0%, #0B0E22 55%, #081016 100%);
    background-attachment: fixed;
  }

  /* Chrome compacté : chaque pixel gagné en haut = plus de place pour les bandes */
  .agenda-head { padding: 6px 10px 0; margin-bottom: 6px; gap: 8px; }
  .agenda-month { font-size: 17px; }
  .agenda-arrow { width: 34px; height: 34px; font-size: 18px; border-radius: 10px; }
  .paint-bar { margin: 0 8px 8px; padding: 4px 5px; }
  .brush { width: 34px; height: 34px; }
  .brush.pill { padding: 0 11px; font-size: 12px; }
  .cal-weekdays div { padding: 5px 0; font-size: 10px; }
  .calendar { border-radius: 0; }
  .cal-scroll { padding-bottom: calc(var(--tab-h) + 30px); }
  .notepad { border-radius: 0; min-height: 0; padding-bottom: calc(var(--tab-h) + 34px); }
}
