/* Direction C — Patient Mobile Design System */

/* ── Design tokens ─────────────────────────────────────────────── */
:root {
  --warm-bg:         #F6F1EA;
  --warm-surface:    #FFFFFF;
  --ink:             #1A1A1A;
  --ink-soft:        #6E6A66;
  --coral:           #C4543F;
  --coral-dark:      #8E3A29;
  --coral-light:     #F8E0D9;
  --outline-variant: #CAC4D0;
  --outline:         #CAC4D0;
  --success:         #3E7B47;

  --font-display: 'PT Serif', 'Times New Roman', Georgia, serif;
  --font-ui:      'Roboto', system-ui, sans-serif;

  /* Spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 28px;
  --sp-8: 32px;

  /* Radius */
  --r-chip:   12px;
  --r-input:  14px;
  --r-card:   16px;
  --r-hero:   20px;
  --r-pill:   100px;

  /* Shadows */
  --shadow-card: 0 1px 2px rgba(0,0,0,.04), 0 6px 18px rgba(0,0,0,.04);
  --shadow-hero: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --shadow-drawer: 0 8px 32px rgba(0,0,0,.18);
}

/* ── Reset & base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body.patient-app {
  margin: 0;
  background: var(--warm-bg);
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}

.patient-shell {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Screen wrapper ────────────────────────────────────────────── */
.p-screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--warm-bg);
}

/* ── Top bar ───────────────────────────────────────────────────── */
.p-topbar {
  display: flex;
  align-items: center;
  padding: 12px 8px;
  gap: 4px;
  flex-shrink: 0;
}

.p-topbar__title {
  flex: 1;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--ink);
}

.p-icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--ink);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.p-icon-btn:active { background: rgba(0,0,0,.06); }
.p-icon-btn .material-symbols-outlined { font-size: 22px; }

/* ── Typography helpers ────────────────────────────────────────── */
.p-eyebrow {
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: 0.7px;
  text-transform: uppercase;
  font-weight: 600;
}

.p-display-l  { font-family: var(--font-display); font-size: 34px; line-height: 40px; font-weight: 400; }
.p-display-m  { font-family: var(--font-display); font-size: 28px; line-height: 34px; font-weight: 400; }
.p-display-s  { font-family: var(--font-display); font-size: 22px; line-height: 28px; font-weight: 400; }
.p-currency-xl{ font-family: var(--font-display); font-size: 44px; line-height: 48px; font-weight: 400; }
.p-title      { font-size: 16px; font-weight: 500; line-height: 22px; }
.p-body       { font-size: 14px; line-height: 20px; }
.p-caption    { font-size: 12px; line-height: 16px; }

/* ── Cards ─────────────────────────────────────────────────────── */
.p-card {
  background: var(--warm-surface);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
}

.p-card--hero {
  border-radius: 24px;
  box-shadow: var(--shadow-hero);
}

/* ── Buttons ───────────────────────────────────────────────────── */
.p-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  padding: 0 24px;
  border: none;
  border-radius: var(--r-card);
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.p-btn:active { opacity: .85; }
.p-btn--primary  { background: var(--ink); color: #fff; }
.p-btn--coral    { background: var(--coral); color: #fff; }
.p-btn--coral-dk { background: var(--coral-dark); color: #fff; }
.p-btn--ghost    { background: #F3E8E1; color: var(--ink); }
.p-btn--outlined { background: transparent; border: 1px solid var(--outline-variant); color: var(--ink); }
.p-btn--outlined-coral { background: transparent; border: 1px solid var(--coral-light); color: var(--coral-dark); }
.p-btn--text     { background: transparent; color: var(--ink); }
.p-btn--pill     { border-radius: var(--r-pill); background: var(--warm-surface); color: var(--ink); }
.p-btn--full     { width: 100%; }
.p-btn--sm       { height: 40px; font-size: 13px; padding: 0 16px; }
.p-btn--h48      { height: 48px; }

/* ── Inputs ────────────────────────────────────────────────────── */
.p-input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: none;
  border-radius: var(--r-input);
  background: var(--warm-surface);
  box-shadow: inset 0 0 0 1px var(--outline-variant);
  font-family: var(--font-ui);
  font-size: 15px;
  color: var(--ink);
  outline: none;
}
.p-input:focus { box-shadow: inset 0 0 0 2px var(--coral); }

/* ── Monogram avatar ───────────────────────────────────────────── */
.p-monogram {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Toggle ────────────────────────────────────────────────────── */
.p-toggle {
  appearance: none;
  width: 44px;
  height: 26px;
  border-radius: 100px;
  background: #D7D2CB;
  position: relative;
  cursor: pointer;
  border: none;
  transition: background .15s;
  flex-shrink: 0;
}
.p-toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
  transition: left .15s;
}
.p-toggle:checked { background: var(--coral); }
.p-toggle:checked::after { left: 21px; }

/* ── Separator ─────────────────────────────────────────────────── */
.p-divider {
  height: 1px;
  background: var(--warm-bg);
  margin: 0;
  border: none;
}

/* ── Section accordion ─────────────────────────────────────────── */
.p-accordion {
  background: var(--warm-surface);
  border-radius: var(--r-card);
  overflow: hidden;
}

.p-accordion__header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-ui);
  -webkit-tap-highlight-color: transparent;
}

.p-accordion__icon-tile {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--coral-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.p-accordion__icon-tile .material-symbols-outlined { font-size: 20px; color: var(--coral-dark); }

.p-accordion__chevron {
  font-size: 20px;
  color: var(--ink-soft);
  transition: transform .2s;
}
.p-accordion__chevron--open { transform: rotate(180deg); }

.p-accordion__body {
  display: none;
  padding: 0 16px 16px 66px;
}
.p-accordion__body--open { display: block; }

/* ── Code boxes (login) ────────────────────────────────────────── */
.p-code-boxes {
  display: flex;
  gap: 8px;
}
.p-code-box {
  flex: 1;
  aspect-ratio: 1 / 1.2;
  max-width: 44px;
  background: var(--warm-surface);
  border-radius: var(--r-chip);
  box-shadow: inset 0 0 0 1px var(--outline-variant);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--ink);
}
.p-code-box--active { box-shadow: inset 0 0 0 2px var(--coral); }
.p-code-box--filled { box-shadow: inset 0 0 0 2px var(--coral); color: var(--ink); }

/* ── Payment tiles ─────────────────────────────────────────────── */
.p-pay-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.p-pay-tile {
  padding: 14px 6px;
  border: none;
  border-radius: var(--r-card);
  background: var(--warm-surface);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  font-family: var(--font-ui);
  -webkit-tap-highlight-color: transparent;
  transition: background .1s, color .1s;
}
.p-pay-tile--selected { background: var(--ink); color: #fff; box-shadow: none; }
.p-pay-tile__n { font-family: var(--font-display); font-size: 22px; line-height: 1; }
.p-pay-tile__label { font-size: 10px; letter-spacing: 0.4px; text-transform: uppercase; opacity: .65; }

/* ── Notifications ─────────────────────────────────────────────── */
.p-notif-row {
  display: flex;
  gap: 12px;
  padding: 14px;
  border-radius: var(--r-card);
  margin-bottom: 6px;
}
.p-notif-row--unread { background: var(--warm-surface); box-shadow: var(--shadow-card); }
.p-notif-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--coral);
  flex-shrink: 0;
  margin-top: 3px;
}

/* ── Unread badge ──────────────────────────────────────────────── */
.p-badge {
  background: var(--coral);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  flex-shrink: 0;
}

/* ── Drawer overlay ────────────────────────────────────────────── */
.p-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20,15,10,.42);
  z-index: 100;
  display: flex;
}
.p-drawer {
  width: 288px;
  height: 100%;
  background: var(--warm-bg);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-drawer);
}
.p-drawer__item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  background: transparent;
  text-align: left;
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.p-drawer__item:active { background: rgba(0,0,0,.05); }

/* ── Chat bubbles ──────────────────────────────────────────────── */
.p-bubble {
  max-width: 78%;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.45;
}
.p-bubble--mine {
  background: var(--ink);
  color: #fff;
  border-radius: 18px 18px 4px 18px;
  align-self: flex-end;
}
.p-bubble--theirs {
  background: var(--warm-surface);
  color: var(--ink);
  border-radius: 18px 18px 18px 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  align-self: flex-start;
}

/* ── Mutuelle card slot ────────────────────────────────────────── */
.p-card-slot {
  aspect-ratio: 1.586 / 1;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
  cursor: pointer;
  text-align: left;
  border: none;
  font-family: var(--font-ui);
  -webkit-tap-highlight-color: transparent;
}
.p-card-slot--empty {
  background: var(--warm-surface);
  border: 2px dashed var(--outline-variant);
}
.p-card-slot--filled { background: #E8DDD4; }

/* ── Settings rows ─────────────────────────────────────────────── */
.p-settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-ui);
  width: 100%;
  border-top: 1px solid var(--warm-bg);
  text-decoration: none;
  color: var(--ink);
}
.p-settings-row:first-child { border-top: none; }

/* ── Sticky footer ─────────────────────────────────────────────── */
.p-sticky-footer {
  background: var(--warm-surface);
  border-top: 1px solid var(--outline-variant);
  padding: 12px 20px 20px;
  flex-shrink: 0;
}

/* ── Hero plan CTA ─────────────────────────────────────────────── */
.p-plan-cta {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--r-card);
  background: var(--coral);
  color: #fff;
  border: none;
  cursor: pointer;
  font-family: var(--font-ui);
  text-align: left;
  width: 100%;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.p-plan-cta__icon-tile {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255,255,255,.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.p-plan-cta__icon-tile .material-symbols-outlined { font-size: 22px; color: #fff; }

/* ── Empty state ───────────────────────────────────────────────── */
.p-empty-icon {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--coral-light);
  display: flex;
  align-items: center;
  justify-content: center;
}
.p-empty-icon .material-symbols-outlined { font-size: 44px; color: var(--coral-dark); }

/* ── Doc row ───────────────────────────────────────────────────── */
.p-doc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}
.p-doc-row .material-symbols-outlined { font-size: 18px; }
.p-doc-row--done .material-symbols-outlined { color: var(--success); }
.p-doc-row--done span { text-decoration: line-through; color: var(--ink-soft); }

/* ── Pay tile info card ────────────────────────────────────────── */
.p-pay-info {
  background: var(--warm-surface);
  border-radius: 20px;
  padding: 20px;
}
.p-pay-detail {
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--warm-bg);
  border-radius: 10px;
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* ── Confirmation ──────────────────────────────────────────────── */
.p-confirm-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--coral-light);
  display: flex;
  align-items: center;
  justify-content: center;
}
.p-confirm-icon .material-symbols-outlined { font-size: 44px; color: var(--coral-dark); }

/* ── Refuse reason row ─────────────────────────────────────────── */
.p-reason-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 14px;
  text-align: left;
  width: 100%;
  background: var(--warm-surface);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
.p-reason-row--selected { background: var(--ink); color: #fff; }
.p-reason-radio {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--outline);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.p-reason-radio--selected { border: none; background: #fff; }
/* Native checkbox hidden; the row + dot reflect the checked state via :has */
.p-reason-check { position: absolute; opacity: 0; pointer-events: none; }
.p-reason-row:has(.p-reason-check:checked) { background: var(--ink); color: #fff; }
.p-reason-row:has(.p-reason-check:checked) .p-reason-radio { border-color: #fff; background: #fff; }
.p-reason-row:has(.p-reason-check:checked) .p-reason-radio::after {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }

/* ── Utilities ─────────────────────────────────────────────────── */
.p-px-5  { padding-inline: var(--sp-5); }
.p-py-3  { padding-block: var(--sp-3); }
.p-mt-4  { margin-top: var(--sp-4); }
.p-mt-5  { margin-top: var(--sp-5); }
.p-gap-2 { gap: var(--sp-2); }
.p-gap-3 { gap: var(--sp-3); }
.p-ink-soft { color: var(--ink-soft); }
.p-serif { font-family: var(--font-display); }
.p-flex  { display: flex; }
.p-flex-col { display: flex; flex-direction: column; }
.p-flex-1   { flex: 1; }
.p-items-center { align-items: center; }
.p-justify-between { justify-content: space-between; }
.p-scroll { overflow-y: auto; flex: 1; }
.p-text-center { text-align: center; }

/* ── Mon dossier strip (mutuelle + sécu) ───────────────────────────────── */
.p-dossier-strip { display: flex; gap: 8px; padding: 12px 20px 4px; }
.p-stat { flex: 1; min-width: 0; background: var(--warm-surface); border: 1px solid var(--outline);
  border-radius: var(--r-card); padding: 12px 14px; }
.p-stat__head { display: flex; align-items: center; gap: 7px; color: var(--ink-soft);
  font-size: 11px; text-transform: uppercase; letter-spacing: .4px; font-weight: 600; }
.p-stat__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.p-stat__val { font-size: 14px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-stat__add { display: inline-flex; align-items: center; gap: 2px; font-size: 11.5px; font-weight: 600; color: var(--coral-dark); white-space: nowrap; }
.p-badge--ok { background: rgba(62, 123, 71, .14); color: var(--success); }

/* ── Patient signature pad (devis reader) ──────────────────────────────── */
.p-sig-toggle { display: inline-flex; gap: 4px; padding: 3px; border-radius: var(--r-pill);
  background: var(--warm-bg); border: 1px solid var(--outline); margin: 12px 0 4px; }
.p-sig-toggle button { border: none; background: transparent; cursor: pointer; padding: 6px 14px;
  border-radius: var(--r-pill); font-family: var(--font-ui); font-size: 13px; color: var(--ink-soft); }
.p-sig-toggle button.active { background: var(--warm-surface); color: var(--ink); box-shadow: var(--shadow-card); }
.p-sig-canvas-wrap { margin-top: 8px; height: 130px; border: 1px dashed var(--outline); border-radius: var(--r-card);
  background: var(--warm-surface); overflow: hidden; }
.p-sig-canvas { width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.p-sig-text.hidden { display: none; }

/* Flow 06 — payment modality tiles (patient) */
.p-tile { display: flex; align-items: center; gap: 13px; width: 100%; text-align: left; padding: 14px;
  border-radius: var(--r-card, 16px); border: 1px solid var(--outline-variant); background: var(--warm-surface);
  cursor: pointer; font-family: var(--font-ui); }
.p-tile--on { border-color: var(--coral); background: var(--coral-light); }
.p-tile__ico { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px;
  flex-shrink: 0; border-radius: 11px; background: var(--coral-light); color: var(--coral-dark); }
.p-tile__ico--ink { background: var(--ink); color: #fff; }
.p-tile__txt { flex: 1; min-width: 0; }
.p-tile__name { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; color: var(--ink); }
.p-tile__sub { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 2px; }

/* Flow 07 — slot chooser (patient picks one of the practitioner's proposed slots) */
.p-slot-option { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 12px 14px; border-radius: var(--r-card, 16px);
  border: 1.5px solid var(--outline-variant); background: var(--warm-surface);
  cursor: pointer; font-family: var(--font-ui); transition: border-color .15s, background .15s; }
.p-slot-option:hover { border-color: var(--coral); background: var(--coral-light); }
