/* ── Variables ── */
:root {
  --bx: #361822;
  --bordeaux: #361822;
  --cr: #FAF7F2;
  --creme: #FAF7F2;
  --cr2: #F0EDE6;
  --cr3: #E8E3DA;
  --creme-muted: rgba(250, 247, 242, 0.45);
  --tm: #1a1a1a;
  --ts: #666;
  --tl: #aaa;
  --bd: rgba(54,24,34,.1);
  --bd2: rgba(54,24,34,.2);
  --border-subtle: rgba(54, 24, 34, 0.12);
  --text-primary: #1a1a1a;
  --text-muted: #999;
  --text-hint: #aaa;
  --done: #2d7a4f;
  --done-bg: #edf7f1;
  --matin: #b8860b;
  --matin-bg: #fdf6e3;
  --soir: #3a4f8a;
  --soir-bg: #eceef8;
}

/* ── Typographie ── */
h1, h2, h3,
.title, .greeting, .welcome-title,
.sheet-title, .consent-title, .s-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
}

body.patient-body {
  font-family: system-ui, -apple-system, sans-serif;
  margin: 0;
  background: var(--bordeaux);
}

/* ── Layout mobile ── */
.patient-screen {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ── Zones deux tons ── */
.zone-bordeaux {
  background: var(--bordeaux);
  color: var(--creme);
  padding: 40px 28px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
}

.zone-creme {
  background: var(--creme);
  border-radius: 20px 20px 0 0;
  padding: 24px 22px 32px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.zone-handle {
  width: 32px;
  height: 3px;
  background: var(--border-subtle);
  border-radius: 2px;
  margin: 0 auto 4px;
}

/* ── Composants ── */

/* Logo */
.patient-logo {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 22px;
  font-weight: 500;
  color: var(--creme);
  letter-spacing: 0.04em;
}
.patient-logo-dark {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 11px;
  font-weight: 700;
  color: var(--bordeaux);
  letter-spacing: 0.04em;
}

/* Section labels */
.section-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-hint);
}

/* Card blanche générique */
.patient-card {
  background: white;
  border-radius: 12px;
  border: 0.5px solid var(--border-subtle);
  overflow: hidden;
}

/* Row dans une card */
.patient-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 0.5px solid #f0ebe0;
}
.patient-row:last-child { border-bottom: none; }

/* Badge docteur */
.doctor-badge {
  background: white;
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0.5px solid var(--border-subtle);
}
.doctor-avatar {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 50%;
  background: var(--bordeaux);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 500;
  color: var(--creme);
}

/* Bulle iMessage */
.bubble-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.bubble {
  background: var(--bordeaux);
  border-radius: 16px 16px 16px 4px;
  padding: 11px 13px;
  font-size: 15px;
  color: var(--creme);
  line-height: 1.5;
}
.bubble-sender {
  font-size: 9px;
  color: var(--text-hint);
  margin-left: 2px;
}
.bubble-time {
  font-size: 9px;
  color: var(--text-hint);
  margin-left: 2px;
}

/* CTA principal */
.patient-cta {
  background: var(--bordeaux);
  color: var(--creme);
  border-radius: 10px;
  padding: 14px;
  font-size: 13px;
  text-align: center;
  cursor: pointer;
  width: 100%;
  border: none;
  font-family: system-ui, -apple-system, sans-serif;
  text-decoration: none;
  display: block;
  box-sizing: border-box;
}
.patient-cta:disabled,
.patient-cta.disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* Lien skip */
.patient-skip {
  text-align: center;
  font-size: 11px;
  color: var(--text-hint);
  text-decoration: underline;
  cursor: pointer;
}

/* Barre de progression dots */
.progress-dots {
  display: flex;
  gap: 4px;
}
.progress-dot {
  height: 3px;
  border-radius: 2px;
  flex: 1;
  background: #c4b8a8;
}
.progress-dot.active {
  background: var(--bordeaux);
}

/* Champ formulaire */
.patient-field label {
  font-size: 10px;
  font-weight: 500;
  color: var(--bordeaux);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 6px;
}
.patient-field input,
.patient-field textarea,
.patient-field select {
  background: white;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-primary);
  width: 100%;
  box-sizing: border-box;
  font-family: system-ui, -apple-system, sans-serif;
}
.patient-field input:focus,
.patient-field textarea:focus,
.patient-field select:focus {
  outline: none;
  border-color: var(--bordeaux);
}
.patient-field .hint {
  font-size: 9px;
  color: var(--text-hint);
  margin-top: 4px;
}

/* Barre de force mot de passe */
.strength-bars {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}
.strength-bar {
  height: 3px;
  flex: 1;
  border-radius: 2px;
  background: #e0dbd2;
  transition: background 0.2s;
}
.strength-bar.active {
  background: var(--bordeaux);
}

/* Bottom sheet */
.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 14, 18, 0.45);
  z-index: 50;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.bottom-sheet-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--creme);
  border-radius: 20px 20px 0 0;
  padding: 0 20px 32px;
  max-width: 430px;
  margin: 0 auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 51;
}
.bottom-sheet.open {
  transform: translateY(0);
}

/* Checkbox custom */
.check-circle {
  width: 18px;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid #c4b8a8;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}
.check-circle.checked {
  background: var(--bordeaux);
  border-color: var(--bordeaux);
}

/* Photo upload card */
.photo-card {
  background: white;
  border: 1.5px dashed rgba(54, 24, 34, 0.25);
  border-radius: 10px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.photo-card.uploaded {
  border: 1.5px solid var(--bordeaux);
}

/* ── Patient view container ── */
.patient-view {
  max-width: 430px;
  margin: 0 auto;
  padding: 16px 20px 80px;
  background: var(--cr);
  min-height: 100vh;
  min-height: 100dvh;
}
.patient-view-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 20px;
  font-weight: 400;
  color: var(--text-primary);
  margin: 0 0 2px;
}
.patient-view-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 18px;
}

/* ── Tab bar ── */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 430px;
  margin: 0 auto;
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 56px;
  background: var(--cr);
  border-top: 1px solid var(--bd);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 100;
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  height: 100%;
  text-decoration: none;
  color: #aaa;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.tab.active {
  color: var(--bordeaux);
}
.tab.locked {
  color: #d4d0ca;
}
.tab-label {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.tab-label.active,
.tab.active .tab-label {
  color: var(--bordeaux);
  font-weight: 600;
}
.notif-count {
  position: absolute;
  top: 6px;
  right: calc(50% - 18px);
  min-width: 14px;
  height: 14px;
  background: #e53e3e;
  color: white;
  font-size: 8px;
  font-weight: 700;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

/* ── Routine expand ── */
.routine-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  margin: 0;
}
.routine-freq {
  font-size: 10px;
  color: var(--text-hint);
  white-space: nowrap;
}
.routine-expand {
  font-size: 10px;
  color: var(--bordeaux);
  text-decoration: none;
  cursor: pointer;
}
.rdot {
  width: 8px;
  height: 8px;
  min-width: 8px;
  border-radius: 50%;
}

/* ── Profile card rows ── */
.profile-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  margin: 0;
}
.profile-hint {
  font-size: 10px;
  color: var(--text-hint);
  margin: 0;
}

/* ── Timeline dots ── */
.timeline-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 10px 0 16px;
}
.timeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(245, 240, 232, 0.3);
}
.timeline-dot.done {
  background: var(--creme);
}
.timeline-dot.current {
  background: var(--creme);
  box-shadow: 0 0 0 3px rgba(245, 240, 232, 0.3);
}
.timeline-line {
  flex: 1;
  height: 1px;
  background: rgba(245, 240, 232, 0.2);
}

/* ── Protocol steps ── */
.protocol-steps ol {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: step;
}
.protocol-steps ol li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 0.5px solid #f0ebe0;
  font-size: 14px;
  color: #2a2a2a;
  line-height: 1.5;
  counter-increment: step;
}
.protocol-steps ol li:last-child {
  border-bottom: none;
}
.protocol-steps ol li::before {
  content: counter(step);
  min-width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #f0ebe0;
  color: #361822;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
  flex-shrink: 0;
}
.protocol-steps p {
  font-size: 14px;
  color: #2a2a2a;
  line-height: 1.5;
  margin: 0 0 6px;
}
.protocol-steps strong {
  color: #1a1a1a;
  font-weight: 500;
}

/* Animation SVG loader */
@keyframes rotate-cw  { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes rotate-ccw { from { transform: rotate(0deg); } to { transform: rotate(-360deg); } }
.spin-cw  { animation: rotate-ccw 3s cubic-bezier(0.4, 0, 0.6, 1) infinite; transform-origin: 26px 28px; }
.spin-ccw { animation: rotate-cw  3s cubic-bezier(0.4, 0, 0.6, 1) infinite; transform-origin: 26px 28px; }

/* ═══════════════════════════════════════════════ */
/* PROTO DESIGN SYSTEM — Classes from proto.html  */
/* ═══════════════════════════════════════════════ */

/* ── Section label ── */
.sl { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--tl); font-weight: 500; }

/* ── Cards ── */
.card { background: #fff; border: 1px solid var(--bd); border-radius: 16px; padding: 18px; }
.card-hl { background: #fff; border: 1.5px solid var(--bx); border-radius: 16px; padding: 18px; }
.card-soft { background: var(--cr2); border-radius: 14px; padding: 14px 16px; }
.card-lock { background: rgba(255,255,255,.45); border: 1.5px dashed #c8c0b8; border-radius: 16px; padding: 16px; }

/* ── Pills (profile rows) ── */
.pill { display: flex; align-items: center; gap: 11px; padding: 13px 0; border-bottom: 1px solid var(--bd); }
.pill:last-child { border-bottom: none; }
.pill-icon { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pill-title { font-size: 15px; font-weight: 500; color: var(--tm); }
.pill-desc { font-size: 13px; color: var(--ts); margin-top: 1px; line-height: 1.4; }

/* ── Timeline ── */
.tl-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.tl-dot { width: 16px; height: 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tld { background: var(--bx); }
.tla { background: var(--bx); box-shadow: 0 0 0 3px rgba(54,24,34,.12); }
.tlp { background: transparent; border: 1.5px solid #ccc; }
.tldk { width: 5px; height: 5px; border-radius: 50%; background: var(--cr); }
.tlck { color: var(--cr); font-size: 8px; font-weight: 600; }
.tl-text { font-size: 14px; font-weight: 500; color: var(--tm); }
.tl-text span { font-weight: 400; color: var(--ts); margin-left: 4px; font-size: 13px; }
.tl-muted .tl-text { color: var(--tl); }
.tl-muted .tl-text span { color: var(--tl); }
.tl-con { width: 1px; height: 6px; background: var(--bd); margin-left: 7px; }
.tl-con.d { background: rgba(54,24,34,.22); }

/* ── Doctor card ── */
.md-card { background: #fff; border-radius: 16px; border: 1px solid var(--bd); overflow: hidden; }
.md-head { padding: 10px 14px; border-bottom: 1px solid var(--bd); display: flex; align-items: center; gap: 9px; }
.md-av { width: 28px; height: 28px; border-radius: 50%; background: var(--cr2); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 500; color: var(--bx); flex-shrink: 0; }
.md-who { font-size: 13px; font-weight: 500; color: var(--tm); }
.md-role { font-size: 11px; color: var(--ts); }
.md-body { padding: 14px 16px; font-size: 15px; color: var(--tm); line-height: 1.6; }

/* ── Tip cards ── */
.tip { background: var(--cr2); border-radius: 14px; padding: 14px 16px; }
.tip .tl-label { font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--ts); margin-bottom: 4px; }
.tip .tl-text-body { font-size: 15px; color: var(--tm); line-height: 1.5; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 20px; font-size: 10px; font-weight: 500; }
.b-bx { background: var(--bx); color: var(--cr); }
.b-wait { background: var(--cr2); color: var(--ts); }
.b-ship { background: #e5f2f4; color: #1a6070; }
.b-ok { background: var(--done-bg); color: var(--done); }

/* ── Buttons ── */
.btn { width: 100%; padding: 13px; background: var(--bx); color: var(--cr); border: none; border-radius: 12px; font-size: 14px; font-weight: 500; cursor: pointer; text-align: center; display: block; text-decoration: none; box-sizing: border-box; font-family: system-ui, -apple-system, sans-serif; }
.btn.off { background: #ccc; color: #999; pointer-events: none; }
.btn-sm { padding: 10px; background: var(--bx); color: var(--cr); border: none; border-radius: 10px; font-size: 14px; font-weight: 500; cursor: pointer; width: 100%; text-align: center; font-family: system-ui, -apple-system, sans-serif; }

/* ── Header (greeting) ── */
.hdr { padding: 20px 0 12px; border-bottom: 1px solid var(--bd); }
.name { font-size: 20px; font-weight: 400; color: var(--tm); font-family: system-ui, -apple-system, sans-serif; }
.name em { font-style: italic; font-size: 22px; font-family: 'Fraunces', Georgia, serif; }
.sub { font-size: 13px; color: var(--ts); margin-top: 2px; }

/* ── Protocol rows ── */
.pr { padding: 12px 0; border-bottom: 1px solid var(--bd); display: flex; gap: 9px; align-items: flex-start; }
.pr:last-child { border-bottom: none; }
.pi { width: 26px; height: 26px; border-radius: 7px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pl { font-size: 9px; letter-spacing: .06em; text-transform: uppercase; color: var(--ts); margin-bottom: 2px; }
.pt { font-size: 14px; color: var(--tm); line-height: 1.4; }

/* ── Skeleton loader ── */
.sk { background: var(--cr3); border-radius: 5px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .45; } 50% { opacity: .9; } }

/* ── Before/After photos ── */
.photo-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 18px 0; }
.photo-card-hero { border-radius: 14px; overflow: hidden; position: relative; aspect-ratio: 3/4; }
.photo-card-lbl { position: absolute; bottom: 0; left: 0; right: 0; padding: 7px 9px; background: rgba(54,24,34,.6); color: var(--cr); }
.photo-card-date { font-size: 10px; font-weight: 500; }
.photo-card-tag { font-size: 9px; opacity: .7; margin-top: 1px; }

/* ── Check-in banner ── */
.ci-banner { background: #fff; border: 1.5px solid var(--bx); border-radius: 16px; padding: 18px; }
.ci-dot { width: 9px; height: 9px; border-radius: 50%; background: #C0404A; flex-shrink: 0; }

/* ── History rows ── */
.hist-row { display: flex; align-items: center; gap: 10px; padding: 13px 0; border-bottom: 1px solid var(--bd); }
.hist-row:last-child { border-bottom: none; }
.hist-thumb { width: 40px; height: 40px; border-radius: 9px; flex-shrink: 0; overflow: hidden; background: #e0dbd2; }
.hist-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ── Chat bubbles ── */
.bubble-dr { display: flex; gap: 7px; align-items: flex-end; }
.bubble-me { display: flex; justify-content: flex-end; }
.bub { padding: 10px 12px; border-radius: 14px; font-size: 15px; line-height: 1.5; max-width: 80%; }
.bub-dr { background: #fff; border: 1px solid var(--bd); color: var(--tm); border-bottom-left-radius: 3px; }
.bub-me { background: var(--bx); color: var(--cr); border-bottom-right-radius: 3px; }
.msg-sep { text-align: center; font-size: 10px; color: var(--tl); margin: 6px 0; }
.new-badge { display: inline-flex; background: #C0404A; color: #fff; font-size: 9px; font-weight: 500; padding: 2px 7px; border-radius: 20px; margin-bottom: 5px; }

/* ── Parcours dark header ── */
.p-hdr { background: var(--bx); padding: 18px 18px 14px; }

/* ── Bottom sheet (proto) ── */
.bso { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(20,6,10,.55); display: none; align-items: flex-end; justify-content: center; z-index: 50; }
.bso.open { display: flex; }
.bs { background: var(--cr); border-radius: 20px 20px 0 0; padding: 20px 20px 32px; width: 100%; max-width: 430px; max-height: 92vh; min-height: 40vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.bsh { width: 32px; height: 3px; background: var(--cr3); border-radius: 2px; margin: 0 auto 14px; }
.bsc { float: right; background: none; border: none; font-size: 20px; color: var(--ts); cursor: pointer; margin-top: -3px; line-height: 1; }

/* ── Score buttons (check-in) ── */
.qp { display: flex; gap: 3px; margin-bottom: 14px; }
.qpd { flex: 1; height: 3px; background: var(--cr3); border-radius: 2px; }
.qpd.on { background: var(--bx); }
.sc-btn { flex: 1; padding: 9px 2px; background: #fff; border: 1px solid var(--bd); border-radius: 9px; font-size: 14px; font-weight: 500; color: var(--tm); cursor: pointer; text-align: center; transition: all .15s; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.sc-btn.sel { background: var(--bx); color: var(--cr); border-color: var(--bx); }
.sc-lbl { font-size: 8px; opacity: .6; line-height: 1.2; }

/* ── Photo type selector ── */
.type-btn { padding: 8px 6px; background: #fff; border: 1px solid var(--bd); border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--tm); cursor: pointer; text-align: center; transition: all .2s; }
.type-btn.sel { border-color: var(--bx); color: var(--bx); background: rgba(54,24,34,.04); }
.zi { width: 100%; padding: 9px 11px; border: 1px solid var(--bd); border-radius: 9px; font-size: 15px; color: var(--tm); background: #fff; outline: none; box-sizing: border-box; font-family: system-ui, -apple-system, sans-serif; }
.zi:focus { border-color: var(--bx); }
textarea.zi { height: 60px; resize: none; line-height: 1.5; }

/* ── Photo tutorial ── */
.photo-tuto { background: #fff; border: 1px solid var(--bd); border-radius: 14px; overflow: hidden; margin-bottom: 12px; }
.tuto-row { display: flex; }
.tuto-h { flex: 1; padding: 10px; text-align: center; border-right: 1px solid var(--bd); }
.tuto-h:last-child { border-right: none; }
.tuto-face { width: 44px; height: 44px; border-radius: 50%; margin: 0 auto 6px; display: flex; align-items: center; justify-content: center; }
.add-btn-row { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 11px; background: #fff; border: 1.5px dashed var(--bd2); border-radius: 11px; font-size: 13px; font-weight: 500; color: var(--bx); cursor: pointer; }

/* ── Photo type selector rows ── */
.type-btn-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #fff; border: 1.5px solid var(--bd); border-radius: 12px; cursor: pointer; transition: all .15s; }
.type-btn-row.sel { border-color: var(--bx); background: rgba(54,24,34,.03); }
.type-btn-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ── Photo list items ── */
.photo-list-item { display: flex; align-items: center; gap: 9px; background: #fff; border: 1px solid var(--bd); border-radius: 10px; padding: 8px 10px; margin-bottom: 7px; }
.photo-list-thumb { width: 36px; height: 36px; border-radius: 7px; flex-shrink: 0; overflow: hidden; }

/* ── Notification dot ── */
.ndot { position: absolute; top: -2px; right: -4px; width: 7px; height: 7px; border-radius: 50%; background: #C0404A; border: 1.5px solid var(--cr); }
