:root {
  /* Thème clair : mêmes couleurs et polices que le site mapapote.fr */
  --bg: #fdfaf5;
  --surface: #ffffff;
  --text: #24212f;
  --muted: #5f5a6b;
  --line: #e9e1d4;
  --accent: #4f46e5;
  --accent-text: #ffffff;
  --warm: #4338ca;
  --danger: #dc2626;
  --ok: #15803d;
  --shadow: 0 1px 2px rgba(36, 33, 47, .05), 0 6px 20px rgba(120, 90, 50, .08);
  --c-call: #15803d;
  --c-photo: #0891b2;
  --c-video: #db2777;
  --c-message: #4f46e5;
  --c-agenda: #7c3aed;
  --c-settings: #5f5a6b;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}

/* Thème : automatique (selon le téléphone), ou choisi dans Réglages (data-theme sur <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121110;
    --surface: #1e1c1a;
    --text: #f5f5f4;
    --muted: #a8a29e;
    --line: #2e2b28;
    --accent: #818cf8;
    --accent-text: #1c1917;
    --danger: #f87171;
    --ok: #4ade80;
    --shadow: none;
    --c-call: #4ade80;
    --c-photo: #22d3ee;
    --c-video: #f472b6;
    --c-message: #818cf8;
    --c-agenda: #a78bfa;
    --c-settings: #d6d3d1;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121110;
  --surface: #1e1c1a;
  --text: #f5f5f4;
  --muted: #a8a29e;
  --line: #2e2b28;
  --accent: #818cf8;
  --accent-text: #1c1917;
  --danger: #f87171;
  --ok: #4ade80;
  --shadow: none;
  --c-call: #4ade80;
  --c-photo: #22d3ee;
  --c-video: #f472b6;
  --c-message: #818cf8;
  --c-agenda: #a78bfa;
  --c-settings: #d6d3d1;
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 var(--body);
}

main { max-width: 640px; margin: 0 auto; }
.page-pad { padding: calc(16px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); }
.page { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }

svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.brand { margin: 8px 0 0; font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.home-head { margin-bottom: 20px; }
.home-head p { margin: 2px 0 0; }

/* ---------- Cartes, champs, boutons ---------- */

.card {
  background: var(--surface);
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 6px; font-size: 19px; }
details.card summary { cursor: pointer; font-weight: 600; }
details.card form { margin-top: 12px; }

label { display: block; font-weight: 600; margin: 14px 0; }
input, textarea, select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 13px 14px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }

button {
  font: inherit;
  font-weight: 600;
  border-radius: 14px;
  padding: 13px 18px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: inherit;
  background: none;
}
button:disabled { opacity: .45; cursor: default; }
.primary { background: var(--accent); color: var(--accent-text); min-height: 54px; }
.link { color: var(--muted); padding: 10px 0; }
.danger { color: var(--danger); }
.wide { width: 100%; margin-top: 8px; }

.icon-btn { width: 44px; height: 44px; padding: 0; border-radius: 50%; }
.icon-btn:active { background: var(--line); }
.icon-btn.del { color: var(--muted); }

.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.error { color: var(--danger); font-weight: 600; }
.seen { color: var(--ok); font-weight: 600; margin: 2px 0 0; }
/* ---------- Écran de démarrage ---------- */

.splash {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--bg);
  animation: fade-in .3s ease-out;
}
.splash-mark {
  width: 96px;
  height: 96px;
  filter: drop-shadow(0 10px 24px color-mix(in srgb, var(--accent) 35%, transparent));
  animation: breathe 1.6s ease-in-out infinite;
}
.splash-name { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.splash-dots { display: flex; gap: 6px; }
.splash-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  opacity: .3;
  animation: dot 1.2s ease-in-out infinite;
}
.splash-dots span:nth-child(2) { animation-delay: .15s; }
.splash-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes breathe { 50% { transform: scale(1.06); } }
@keyframes dot { 30% { opacity: 1; transform: translateY(-4px); } }
@keyframes fade-in { from { opacity: 0; } }

.install-card p { margin: 0 0 8px; }
.install-help { margin-top: 12px; }
.install-help ol { margin: 8px 0; padding-left: 22px; }
.install-help li { margin: 6px 0; }

.activity {
  margin: 0 0 16px;
  padding: 12px 14px 12px 34px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 15px;
  position: relative;
}
.activity::before {
  content: "";
  position: absolute;
  left: 14px; top: 50%;
  width: 10px; height: 10px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--ok);
}
.activity.warn { color: var(--danger); font-weight: 600; }
.activity.warn::before { background: var(--danger); }

/* ---------- Accueil : six grandes tuiles ---------- */

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tile {
  --c: var(--accent);
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  min-height: 132px;
  padding: 18px;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
  font-size: 19px;
  font-weight: 700;
  transition: transform .12s;
}
.tile:active { transform: scale(.97); }
.tile-icon {
  width: 52px;
  height: 52px;
  padding: 13px;
  border-radius: 16px;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, transparent);
  stroke-width: 2.2;
}
.t-call { --c: var(--c-call); }
.t-photo { --c: var(--c-photo); }
.t-video { --c: var(--c-video); }
.t-message { --c: var(--c-message); }
.t-agenda { --c: var(--c-agenda); }
.t-settings { --c: var(--c-settings); }

/* ---------- Pages ---------- */

.page-head {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: calc(8px + env(safe-area-inset-top)) 8px 8px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.page-head h1 { margin: 0; font-size: 22px; font-weight: 800; }
.page-head svg { width: 26px; height: 26px; }

.empty { text-align: center; color: var(--muted); padding: 60px 24px; }

.fab {
  position: fixed;
  right: max(20px, calc(50% - 300px));
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 6;
  width: 64px;
  height: 64px;
  padding: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 40%, transparent);
}
.fab svg { width: 30px; height: 30px; stroke-width: 2.5; }

/* ---------- Fil des photos / vidéos : une par ligne, image entière, sans arrondi ---------- */

.gallery { list-style: none; margin: 0 auto; padding: 4px 0; max-width: 640px; }
.shot {
  margin-bottom: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.feed-more { height: 1px; }
.shot-frame { display: block; position: relative; width: 100%; padding: 0; border-radius: 0; }
.shot-frame img { display: block; width: 100%; height: auto; background: var(--line); }
.shot-play {
  position: absolute;
  left: 50%; top: 50%;
  width: 52px; height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.shot-play svg { stroke: none; margin-left: 3px; }
.shot-duration {
  position: absolute;
  right: 6px; bottom: 6px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  font-size: 13px;
}
.shot-meta { display: flex; align-items: center; gap: 10px; padding: 10px 6px 12px 16px; }
.shot-info { flex: 1; min-width: 0; }
.shot-info p { margin: 0; }
.shot-caption { font-size: 17px; margin-bottom: 2px !important; overflow-wrap: anywhere; }
.shot-meta .muted { font-size: 13px; }
.shot-meta .seen { font-size: 13px; }

/* ---------- Messages : conversation ---------- */

.chat { list-style: none; margin: 0; padding: 8px 14px; display: flex; flex-direction: column; gap: 8px; }
.bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.bubble p { margin: 0; }
.bubble.mine { align-self: flex-end; background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 6px; cursor: pointer; }
.bubble.theirs { align-self: flex-start; border-bottom-left-radius: 6px; }
.bubble.reply { border: 2px solid var(--ok); }
.bubble-who { font-size: 13px; font-weight: 700; color: var(--muted); }
.reply .bubble-who { color: var(--ok); }
.bubble-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 17px; }
.bubble-foot { font-size: 12px; opacity: .75; margin-top: 2px !important; text-align: right; }

.chat-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 6;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 640px;
  margin: 0 auto;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.chat-field { flex: 1; position: relative; }
.chat-field textarea {
  margin: 0;
  resize: none;
  max-height: 140px;
  overflow-y: hidden;
  border-radius: 22px;
  padding: 12px 16px;
  background: var(--surface);
}
.chat-field span { position: absolute; right: 14px; top: -20px; }
.send-round {
  width: 50px; height: 50px;
  padding: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
}

/* ---------- Agenda ---------- */

.list { list-style: none; margin: 0; padding: 4px 16px; }
.reminder {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 14px 8px 14px 16px;
  margin-bottom: 12px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.reminder-body { flex: 1; min-width: 0; }
.reminder-body p { margin: 0; }
.reminder-kind { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--c-agenda); }
.k-medicament { color: var(--c-video); }
.k-rdv { color: var(--c-photo); }
.reminder-title { font-size: 18px; font-weight: 600; }
.reminder-when { margin-top: 2px !important; }

.choice, .days { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.choice label, .days label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  font-weight: 500;
}
.choice label:has(input:checked), .days label:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.choice input, .days input { width: auto; margin: 0; display: inline; accent-color: var(--accent); }

/* ---------- Feuilles (ajout photo, vidéo, rappel) ---------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 15;
  background: rgba(0, 0, 0, .4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet-body {
  width: 100%;
  max-width: 640px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 8px 18px calc(22px + env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0;
  background: var(--surface);
  animation: rise .2s ease-out;
}
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin: 0 -8px 8px 0; }
.sheet-head h2 { margin: 0; font-size: 20px; }

.pickers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.picker {
  flex-direction: column;
  min-height: 112px;
  border-radius: 18px;
  background: var(--bg);
  font-size: 16px;
}
.picker svg { width: 32px; height: 32px; color: var(--accent); }

.previews { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 12px; }
.preview { position: relative; }
.preview img { height: 110px; width: auto; display: block; }
.preview button {
  position: absolute; top: -8px; right: -8px;
  width: 30px; height: 30px; padding: 0;
  border-radius: 50%; background: var(--text); color: var(--bg);
}
.preview button svg { width: 16px; height: 16px; stroke-width: 3; }
.video-preview { width: 100%; max-height: 50vh; background: #000; margin-bottom: 12px; }
#post-text { margin: 0; }
.send-btn { margin-top: 12px; }
.composer-busy, .busy .previews { opacity: .5; }

.spinner {
  width: 18px;
  height: 18px;
  border: 3px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(104px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 18;
  margin: 0;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
}

/* ---------- Réglages ---------- */

.code {
  font: 700 30px/1.2 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 3px;
  text-align: center;
  padding: 14px;
  background: var(--bg);
  border-radius: 14px;
  user-select: all;
}
.members { list-style: none; padding: 0; margin: 0; }
.members li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.members li:last-child { border-bottom: none; }

/* ---------- Visionneuse ---------- */

.viewer {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.viewer img, .viewer video { max-width: 100%; max-height: 82vh; object-fit: contain; }
.viewer-close {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  right: 10px;
  color: #fff;
  background: rgba(255, 255, 255, .15);
}
.viewer-caption { color: #eee; padding: 12px 20px; margin: 0; text-align: center; }

/* ---------- Appel vidéo ---------- */

.call { position: fixed; inset: 0; z-index: 30; background: #000; }
.call video { object-fit: cover; background: #000; }
#call-remote { position: absolute; inset: 0; width: 100%; height: 100%; }
#call-local {
  position: absolute;
  right: 16px;
  top: calc(16px + env(safe-area-inset-top));
  width: 28vw;
  max-width: 180px;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, .7);
  transform: scaleX(-1);
}
@media (orientation: landscape) {
  #call-local { width: 22vw; max-width: 240px; }
}
.call-status {
  position: absolute;
  left: 16px; right: 16px;
  top: 40%;
  margin: 0;
  text-align: center;
  color: #fff;
  font-size: 22px;
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .8);
}
.call-hangup {
  position: absolute;
  left: 50%;
  bottom: calc(32px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: #dc2626;
  color: #fff;
  padding: 16px 36px;
  border-radius: 999px;
  font-size: 18px;
}

/* ---------- Barre de navigation ---------- */

.tab-page { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 8;
  display: flex;
  justify-content: center;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.nav-item {
  flex: 1;
  max-width: 200px;
  flex-direction: column;
  gap: 2px;
  padding: 6px 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.nav-item svg { width: 26px; height: 26px; }
.nav-item.active { color: var(--accent); }
.nav-icon { position: relative; display: flex; }
.nav-badge {
  position: absolute;
  top: -4px; right: -10px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

/* ---------- Notifications ---------- */

.notifs { list-style: none; margin: 0; padding: 4px 16px; }
.notif {
  --c: var(--muted);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
}
.notif:last-child { border-bottom: none; }
.notif-icon {
  width: 40px; height: 40px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, transparent);
}
.notif-icon svg { width: 20px; height: 20px; }
.notif-body { flex: 1; min-width: 0; }
.notif-body p { margin: 0; overflow-wrap: anywhere; }
.notif.fresh .notif-body p:first-child { font-weight: 700; }
.n-photo { --c: var(--c-photo); }
.n-video { --c: var(--c-video); }
.n-message { --c: var(--c-message); }
.n-seen { --c: var(--ok); }
.n-call { --c: var(--c-call); }
.n-agenda { --c: var(--c-agenda); }
.n-member { --c: var(--c-settings); }

/* ---------- Support ---------- */

.faq details {
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 10px;
  padding: 0 16px;
}
.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 24px 16px 0;
  font-weight: 600;
  position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  position: absolute;
  right: 4px; top: 50%;
  width: 8px; height: 8px;
  margin-top: -6px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform .15s;
}
.faq details[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
.faq details p { margin: 0 0 14px; color: var(--muted); }
.tab-page .page-head { padding-left: 20px; padding-top: calc(16px + env(safe-area-inset-top)); }
.notifs-status { margin: 4px 16px 8px; }
.contact-btn { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; border-radius: 14px; font-weight: 600; text-decoration: none; }

/* ---------- Photos de profil ---------- */

.avatar {
  width: 40px; height: 40px;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.avatar-lg { width: 96px; height: 96px; }
.avatar-empty { background: var(--bg); color: var(--muted); border: 2px dashed var(--line); }
.avatar-empty svg { width: 45%; height: 45%; }
.face-row { display: flex; align-items: center; gap: 16px; margin-top: 12px; }
.face-buttons { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.secondary { background: var(--bg); color: var(--text); border: 1px solid var(--line); justify-content: flex-start; font-size: 15px; padding: 10px 14px; }
.secondary svg { width: 20px; height: 20px; color: var(--accent); }
.face-buttons .link { justify-content: flex-start; padding: 4px 0; font-size: 15px; }

.nudge { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; font-weight: 400; }
.nudge .avatar-empty { width: 48px; height: 48px; color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }

.members li { display: flex; align-items: center; gap: 12px; }
.bubble.with-face { position: relative; margin-left: 46px; }
.bubble.with-face > .avatar { position: absolute; left: -46px; bottom: 0; width: 36px; height: 36px; }

/* ---------- Agenda : rappels et anniversaires ---------- */

.list-title { font-size: 15px; color: var(--muted); margin: 16px 20px 8px; text-transform: uppercase; letter-spacing: .05em; }
.k-anniv { color: var(--accent); }
.segmented { display: flex; gap: 4px; padding: 4px; margin: 4px 0 8px; border-radius: 14px; background: var(--bg); }
.seg { flex: 1; padding: 10px; border-radius: 10px; color: var(--muted); }
.seg.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.bday-date { display: grid; grid-template-columns: 1fr 1.6fr 1.4fr; gap: 10px; }
.bday-date label { margin: 14px 0 0; }

.qr { width: 220px; max-width: 70%; margin: 12px auto; background: #fff; padding: 6px; }
.qr svg { display: block; width: 100%; height: auto; }
.qr svg { stroke: none; }
.qr svg rect { fill: #fff; }
.qr svg path { fill: #000; }

/* ---------- Visionneuse : enregistrer, supprimer ---------- */

.viewer-actions { display: flex; gap: 12px; padding: 0 16px calc(16px + env(safe-area-inset-bottom)); }
.viewer-btn { color: #fff; background: rgba(255, 255, 255, .14); border-radius: 999px; padding: 10px 18px; font-size: 15px; }
.viewer-btn svg { width: 20px; height: 20px; }
#viewer-delete { color: #fca5a5; }

/* Corbeille dans les bulles de message */
.bubble-del { padding: 0 6px 0 0; color: inherit; opacity: .8; vertical-align: middle; }
.bubble-del svg { width: 16px; height: 16px; }

/* ---------- Réglages : nom de Mamie, responsables ---------- */

.inline-field { display: flex; gap: 8px; margin-top: 10px; }
.inline-field input { margin: 0; flex: 1; min-width: 0; }
.inline-field button { min-height: 0; }
.members li { flex-wrap: wrap; }
.member-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge { font-size: 12px; font-weight: 700; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); padding: 2px 8px; border-radius: 999px; }
.member-actions { display: flex; gap: 14px; width: 100%; padding-left: 52px; }
.member-actions .link { padding: 2px 0; }

.outbox { margin: 0 0 16px; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--c-agenda) 14%, var(--surface)); font-size: 15px; font-weight: 600; }

.read-badge { flex: none; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.read-badge.read { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.read-badge.unread { color: var(--muted); background: var(--bg); border: 1px solid var(--line); }

/* ---------- Connexion ---------- */

.login-hero { text-align: center; margin: 6vh 0 24px; }
.login-logo { width: 88px; height: 88px; }
.login-hero .brand { margin-top: 10px; }
.login-hero p { margin: 4px 0 0; }
.google-btn { background: var(--surface); color: var(--text); border: 1px solid var(--line); min-height: 54px; margin-top: 0; }
.google-btn svg { width: 22px; height: 22px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; margin: 16px 0 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.pending-spin { display: inline-block; margin: 8px auto 4px; color: var(--accent); }

/* ---------- Plusieurs familles, demandes ---------- */

.family-switch { width: auto; max-width: 100%; margin-top: 6px; padding: 8px 12px; font-weight: 600; background: var(--surface); }
.pending-banner {
  width: 100%;
  margin: 0 0 16px;
  justify-content: flex-start;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--accent);
  border-radius: 14px;
}
.small-btn { min-height: 0; padding: 8px 14px; font-size: 15px; }

/* ---------- Fenêtres de confirmation ---------- */

.dialog-back {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, .45);
  animation: fade-in .15s ease-out;
}
.dialog-back.closing { opacity: 0; transition: opacity .15s; }
.dialog {
  width: 100%;
  max-width: 360px;
  padding: 22px 20px 18px;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
  animation: rise .18s ease-out;
}
.dialog p { margin: 0 0 18px; font-size: 17px; line-height: 1.45; }
.dialog-buttons { display: flex; gap: 10px; }
.dialog-buttons button { flex: 1; min-height: 48px; justify-content: center; }
.danger-btn { background: var(--danger); color: #fff; }
.data-card p { margin: 10px 0; } .data-card summary { font-size: 19px; }

/* Envoi de plusieurs photos : défilement horizontal, une photo à la fois */
.shot-multi { position: relative; }
.shot-strip { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; align-items: center; background: #000; }
.shot-strip::-webkit-scrollbar { display: none; }
.shot-strip .shot-frame { flex: 0 0 100%; scroll-snap-align: center; }
.shot-strip img { max-height: 75vh; object-fit: contain; }
.shot-count { position: absolute; right: 10px; top: 10px; padding: 3px 10px; border-radius: 999px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 13px; font-weight: 700; }

/* ---------- Abonnement ---------- */

.abo-banner { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); font-weight: 600; }
.abo-banner p { margin: 0; flex: 1; font-size: 15px; }
.abo-status { margin: 4px 0; font-size: 18px; font-weight: 700; }
.abo-status.s-actif, .abo-status.s-offert { color: var(--ok); }
.abo-status.s-impaye, .abo-status.s-suspendu, .abo-status.s-resilie, .abo-status.s-aucun { color: var(--danger); }
.abo-formules { display: grid; gap: 10px; margin: 10px 0; }
.abo-formule { flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); text-align: left; }
.abo-formule span { color: var(--muted); font-weight: 500; font-size: 15px; }

/* ---------- Tablette à distance ---------- */

.remote-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.remote-buttons .secondary { justify-content: center; }
.remote-wifi summary { cursor: pointer; font-weight: 600; padding: 8px 0; }
.remote-result { margin: 12px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--bg); font-weight: 600; }
.remote-result.ok { color: var(--ok); }
.remote-result.warn { color: var(--danger); }

/* ---------- Premier lancement guidé ---------- */

.guide-back { position: fixed; inset: 0; z-index: 35; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(0, 0, 0, .5); animation: fade-in .2s ease-out; }
.guide { width: 100%; max-width: 360px; padding: 28px 22px 18px; border-radius: 24px; background: var(--surface); text-align: center; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); animation: rise .2s ease-out; }
.guide-icon { display: inline-flex; width: 72px; height: 72px; align-items: center; justify-content: center; border-radius: 22px; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.guide-icon svg { width: 36px; height: 36px; }
.guide h2 { margin: 16px 0 8px; font-size: 22px; }
.guide p { margin: 0 0 18px; color: var(--muted); font-size: 17px; }
.guide-dots { display: flex; justify-content: center; gap: 8px; margin-bottom: 18px; }
.guide-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.guide-dots span.on { background: var(--accent); width: 22px; border-radius: 4px; }
.guide-buttons { display: flex; justify-content: space-between; align-items: center; }
.guide-buttons .primary { min-height: 48px; padding: 0 22px; margin-left: auto; }

.remote-buttons #btn-logs { grid-column: 1 / -1; }
.logs { max-height: 50vh; overflow: auto; margin: 6px 0 0; padding: 10px; border-radius: 10px; background: var(--bg); font-size: 11px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.abo-banner { flex-wrap: wrap; }

.order-wrap { width: 100%; color: var(--text); font-weight: 400; }
.order-wrap p { margin: 4px 0 8px; }
.order-link { display: flex; gap: 8px; }
.order-link input { margin: 0; flex: 1; min-width: 0; text-transform: uppercase; }

/* Titres dans la police du site */
h1, h2, h3, .brand, .tile, .splash-name { font-family: var(--display); letter-spacing: -.01em; }

/* Bouton « Inviter » en haut à droite de l'accueil */
.home-head { position: relative; }
.invite-btn { position: absolute; right: 0; top: 4px; gap: 6px; padding: 8px 14px; border-radius: 999px; font-size: 15px; background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
.invite-btn svg { width: 20px; height: 20px; }

/* Appel à l'horizontale même quand le téléphone ne tourne pas l'écran */
@media (orientation: portrait) {
  .call.force-landscape {
    inset: auto;
    top: 0; left: 100vw;
    width: 100vh; height: 100vw;
    transform-origin: top left;
    transform: rotate(90deg);
  }
}
.site-link { display: flex; justify-content: center; text-decoration: none; margin-top: 16px; border-radius: 14px; padding: 13px 18px; font-weight: 600; }

/* Bouton flottant « Installer l'app » (disparaît une fois l'app installée) */
.install-fab {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(88px + env(safe-area-inset-bottom));
  z-index: 7;
  gap: 8px;
  padding: 14px 22px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 40%, transparent);
  white-space: nowrap;
}
.install-fab svg { width: 22px; height: 22px; }

.switch-row { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.switch-row input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }
.sleep-hours { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sleep-hours label { margin: 6px 0; }

.settings-group { margin: 22px 4px 10px; font-size: 14px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.settings-group:first-of-type { margin-top: 4px; }
.remote-buttons { grid-template-columns: 1fr; }

.volume-row { display: flex; align-items: center; gap: 12px; }
.volume-row input { flex: 1; margin: 0; padding: 0; accent-color: var(--accent); background: none; border: none; }
.volume-value { min-width: 52px; text-align: right; font-weight: 700; }
.disabled-card { opacity: .5; pointer-events: none; }

/* Chat d'aide (chat-support.js) : seulement sur la page Support. */
body:not(.on-support) .ps-bouton, body:not(.on-support) .ps-panneau { display: none !important; }
/* Place sous le dernier élément pour la barre du bas et le bouton du chat. */
.support-pad { padding-bottom: calc(170px + env(safe-area-inset-bottom)); }

.remote-panel { position: relative; margin-top: 12px; padding: 12px 14px; padding-right: 44px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); }
.remote-panel .remote-result { margin: 0; padding: 0; background: none; }
.panel-close { position: absolute; top: 6px; right: 6px; }
#wifi-box { padding-right: 14px; }
#wifi-box form { margin-top: 28px; }

.abo-retour { margin-top: 14px; padding: 14px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.abo-retour-title { margin: 0 0 8px; font-weight: 700; }
.abo-retour .primary { display: block; text-align: center; text-decoration: none; }

.dialog-title { margin: 0 0 8px; font-family: var(--display); font-size: 22px; }
.dialog-list { margin: 0 0 12px; padding-left: 20px; }
.dialog-list li { margin: 4px 0; }
.dialog-buttons.stack { flex-direction: column; align-items: stretch; }
.dialog-buttons.stack button { width: 100%; }
