/* Polices : déposer les fichiers .woff2 dans public/fonts/ (voir INSTALL.md).
   Sans eux, le navigateur utilise Georgia et la police du système. */
@font-face { font-family: 'Cormorant Garamond'; font-weight: 600; font-display: swap; src: url('/fonts/cormorant-garamond-600.woff2') format('woff2'); }
@font-face { font-family: 'DM Sans'; font-weight: 400 700; font-display: swap; src: url('/fonts/dm-sans.woff2') format('woff2'); }

:root {
  --brown: #381f14;
  --gold: #c89c63;
  --orange: #c46a15;
  --cream: #f5f0ea;
  --copper: #a06a45;
  --muted: #7a5238;
  --card: #fbf8f4;
  --line: #e4d8c8;
  --danger: #9b2c1d;
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--cream);
  color: var(--brown);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; line-height: 1.1; text-wrap: balance; }
h1 { font-size: 38px; }
h2 { font-size: 26px; }
h3 { font-size: 22px; }
p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Structure ---------- */
.shell { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.screen {
  flex: 1; display: flex; flex-direction: column; gap: 20px;
  padding: max(32px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) 24px max(24px, env(safe-area-inset-left));
}
.eyebrow { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.between { justify-content: space-between; }

/* ---------- Cartes ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.card.dark { background: var(--brown); border-color: var(--brown); border-radius: 24px; padding: 24px; gap: 16px; color: var(--cream); }
.card.dark .eyebrow { color: var(--gold); font-weight: 700; }
.card.dark .quote { font-family: var(--serif); font-weight: 600; font-size: 30px; line-height: 1.15; }

/* ---------- Boutons ---------- */
.btn {
  min-height: 48px; padding: 0 22px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--gold); color: var(--brown); font-weight: 700; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; text-align: center;
}
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.block { width: 100%; min-height: 52px; }
.btn.ghost { background: transparent; border: 1.5px solid var(--gold); }
.btn.danger { background: transparent; border: 1.5px solid var(--danger); color: var(--danger); }
.btn.small { min-height: 44px; padding: 0 16px; font-size: 15px; }
.link { background: none; border: 0; padding: 0; min-height: 44px; cursor: pointer; text-decoration: underline; text-decoration-color: var(--orange); text-underline-offset: 4px; font-weight: 500; }
.link.danger { color: var(--danger); text-decoration-color: var(--danger); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--gold); background: transparent; cursor: pointer; font-weight: 500; font-size: 15px; }
.chip[aria-pressed='true'] { background: var(--gold); }

/* ---------- Formulaires ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-weight: 700; font-size: 15px; }
input[type='text'], input[type='email'], input[type='password'], textarea, select {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 14px; border: 1.5px solid var(--gold); background: var(--card);
}
textarea { min-height: 140px; line-height: 1.5; resize: vertical; }
.check { display: flex; gap: 12px; align-items: center; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--orange); flex: none; }
.error { color: var(--danger); font-weight: 500; }
.notice { background: #fff3e0; border: 1px solid var(--orange); border-radius: 14px; padding: 12px 14px; }
.secret { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 20px; letter-spacing: .04em; user-select: all; word-break: break-all; }

/* ---------- Navigation du bas ---------- */
.nav {
  position: sticky; bottom: 0; display: flex; justify-content: space-around; background: var(--cream); border-top: 1px solid var(--line);
  padding: 10px 8px max(14px, env(safe-area-inset-bottom));
}
.nav a { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 64px; min-height: 44px; font-size: 12px; font-weight: 500; color: var(--muted); text-decoration: none; }
.nav a .pill { width: 56px; height: 30px; border-radius: 15px; display: flex; align-items: center; justify-content: center; }
.nav a[aria-current='page'] { color: var(--brown); font-weight: 700; }
.nav a[aria-current='page'] .pill { background: var(--gold); }
svg.icon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Éléments du quotidien ---------- */
.task { width: 100%; text-align: left; display: flex; gap: 14px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 16px; min-height: 44px; cursor: pointer; }
.task .box { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1.8px solid var(--orange); display: flex; align-items: center; justify-content: center; }
.task[aria-pressed='true'] .box { background: var(--gold); border-color: var(--gold); }
.task .box svg { width: 18px; height: 18px; stroke: var(--brown); stroke-width: 2.4; fill: none; opacity: 0; }
.task[aria-pressed='true'] .box svg { opacity: 1; }
.task .t { font-weight: 500; line-height: 1.3; }
.week { display: flex; justify-content: space-between; }
.dot { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; border: 1.5px dashed var(--copper); color: var(--muted); font-weight: 500; }
.dot.done { background: var(--gold); border: 0; color: var(--brown); font-weight: 700; }
.dot.today { border: 2px solid var(--orange); color: var(--brown); font-weight: 700; }
.dot.today.done { background: var(--gold); }
.bar { height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; }
.bar > div { height: 100%; background: var(--gold); border-radius: 5px; transition: width .3s; }

.entry .meta { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
.entry .meta b { color: var(--brown); }
.entry p { white-space: pre-wrap; overflow-wrap: anywhere; }

.res { display: flex; gap: 14px; align-items: center; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 14px 16px; min-height: 44px; cursor: pointer; }
.res .ic { flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--gold); display: flex; align-items: center; justify-content: center; }
.res .tt { font-weight: 500; line-height: 1.3; }
audio { width: 100%; }
.steps { white-space: pre-wrap; line-height: 1.6; }

/* ---------- Respiration ---------- */
.breathe { background: var(--brown); color: var(--cream); }
.breathe .back { color: var(--cream); }
.orb { position: relative; width: 260px; height: 260px; max-width: 70vw; max-height: 70vw; margin: 0 auto; }
.orb .ring { position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid rgba(200, 156, 99, .55); }
.orb .fill { position: absolute; inset: 0; border-radius: 50%; background: var(--gold); animation: breath 10s ease-in-out infinite; }
.orb .word { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-weight: 600; font-size: 34px; color: var(--brown); }
.orb .in { animation: wIn 10s linear infinite; }
.orb .out { animation: wOut 10s linear infinite; opacity: 0; }
.orb .still { display: none; }
@keyframes breath { 0% { transform: scale(.62); } 40% { transform: scale(1); } 100% { transform: scale(.62); } }
@keyframes wIn { 0%, 38% { opacity: 1; } 42%, 100% { opacity: 0; } }
@keyframes wOut { 0%, 38% { opacity: 0; } 42%, 96% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .orb .fill { animation: none; transform: scale(.8); }
  .orb .in, .orb .out { display: none; }
  .orb .still { display: flex; }
}

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--brown); color: var(--cream); padding: 12px 18px; border-radius: 999px; font-weight: 500; z-index: 20; max-width: 90vw; text-align: center; }

/* ---------- Connexion ---------- */
.login { justify-content: center; }
.login .brand { font-family: var(--serif); font-weight: 600; font-size: 44px; line-height: 1; }

/* ---------- Back-office (plus large) ---------- */
.admin-shell { max-width: 960px; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 20px 60px; display: flex; flex-direction: column; gap: 24px; }
.topbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tab { min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1.5px solid var(--gold); background: transparent; cursor: pointer; font-weight: 500; text-decoration: none; display: inline-flex; align-items: center; }
.tab[aria-current='page'] { background: var(--gold); font-weight: 700; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.client-card { text-align: left; cursor: pointer; width: 100%; }
.client-card:hover { border-color: var(--gold); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--line); }
.badge.warn { background: #fde7c7; }
.badge.off { background: #e9d4cf; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; align-items: start; }
.list-item { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item > div { min-width: 0; overflow-wrap: anywhere; }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 4px; }
