/* Shift MD — the doctor app. Same neo-brutalist system as shift.med:
   yellow paper, 1.5px ink lines, hard offset shadows, GT Walsheim. Mobile-first
   (iOS/Android PWA): 16px inputs (no iOS zoom), 44px+ targets, safe areas. */

@font-face {
  font-family: "GT Walsheim Wero";
  src: url("../fonts/GT-Walsheim-wero-Regular.B6B2d_Jf.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "GT Walsheim Wero";
  src: url("../fonts/GT-Walsheim-wero-Bold.a1RV7tRg.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "GT Walsheim Wero";
  src: url("../fonts/GT-Walsheim-wero-Black.B7aObPLX.woff2") format("woff2");
  font-weight: 900; font-style: normal; font-display: swap;
}

:root {
  --ink: #1d1c1c;
  --mint: #78e5ae;
  --mint-soft: #d7f5de;
  --yellow: #fff48d;
  --yellow-soft: #fdf7cf;
  --white: #ffffff;
  /* Clean near-white canvas: the app is a daily tool, so the brand yellow
     moves from background to accent. Cards are pure white and lift off this
     faint warm tint with the ink border + hard shadow. */
  --canvas: #f7f7f4;
  --green-dark: #158460;
  --ember: #fd8559;
  --line: 1.5px solid var(--ink);
  --shadow: 0 5px 0 var(--ink);
  --shadow-sm: 0 3px 0 var(--ink);
  --radius: 14px;
  --pad: clamp(1rem, 4vw, 1.5rem);
  --tabbar-h: calc(64px + env(safe-area-inset-bottom, 0px));
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { overflow-x: clip; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: "GT Walsheim Wero", Arial, Helvetica, sans-serif;
  line-height: 1.3;
  overflow-x: clip;
  min-height: 100dvh;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ── Topbar ─────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(0.65rem + env(safe-area-inset-top, 0px)) var(--pad) 0.65rem;
  background: var(--canvas);
  border-bottom: var(--line);
}
.brand { display: flex; align-items: center; gap: 0.5rem; }
.topbar-right { display: flex; align-items: center; gap: 0.5rem; }
.langbtn {
  min-height: 36px; padding: 0.25rem 0.6rem;
  border: var(--line); border-radius: 10px;
  background: var(--white); font-weight: 900; font-size: 0.78rem;
  letter-spacing: 0.04em; cursor: pointer; box-shadow: var(--shadow-sm);
}
.langbtn:active { transform: translateY(2px); box-shadow: none; }
.brand-logo { height: 22px; display: block; }
.brand-md {
  font-weight: 900; font-size: 0.72rem; letter-spacing: 0.06em;
  background: var(--ink); color: var(--yellow);
  padding: 0.18rem 0.42rem; border-radius: 7px;
}

/* ── Layout ─────────────────────────────────────────────────────────── */
#app {
  max-width: 680px;
  margin: 0 auto;
  padding: 1.1rem var(--pad) calc(var(--tabbar-h) + 3.5rem);
}
h1 { font-weight: 900; font-size: clamp(2rem, 8vw, 2.9rem); line-height: 1.02; margin: 0 0 0.6rem; }
h2 { font-weight: 900; font-size: clamp(1.45rem, 6vw, 1.8rem); margin: 0.2rem 0 0.35rem; }
.hl { background: var(--mint); padding: 0 0.18em; border-radius: 8px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.sect {
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  opacity: 0.62; margin: 1.4rem 0 0.55rem;
}
.muted { opacity: 0.62; margin: 0.1rem 0 0; font-size: 0.95rem; }

/* ── Cards, buttons, fields ─────────────────────────────────────────── */
.card {
  background: var(--white);
  border: var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  min-height: 48px; padding: 0.65rem 1.15rem;
  border: var(--line); border-radius: 12px;
  background: var(--white);
  font-weight: 700; cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.btn-mint { background: var(--mint); }
.btn-ink { background: var(--ink); color: var(--yellow); }
.btn-ghost { box-shadow: none; min-height: 40px; padding: 0.4rem 0.8rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; pointer-events: none; }
.btn.is-busy .btn-label { visibility: hidden; }
.btn.is-busy::after {
  content: ""; position: absolute;
  width: 18px; height: 18px; border: 2.5px solid currentColor;
  border-top-color: transparent; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn { position: relative; }
@keyframes spin { to { transform: rotate(360deg); } }

.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border: var(--line); border-radius: 12px;
  background: var(--white); cursor: pointer; box-shadow: var(--shadow-sm);
}
.iconbtn:active { transform: translateY(2px); box-shadow: none; }
.iconbtn.is-rec { background: var(--ember); animation: pulse 1.2s ease infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }

.fld { display: block; margin: 0 0 0.85rem; }
.fld > span, .fld-label {
  display: block; font-size: 0.82rem; font-weight: 700; margin-bottom: 0.3rem;
}
.fld input, .fld select, .fld textarea, .fields input[type="text"], .fields select {
  width: 100%;
  font-size: 16px;
  padding: 0.7rem 0.8rem;
  border: var(--line); border-radius: 11px;
  background: var(--white);
  outline: none;
}
.fld input:focus, .fld select:focus, .fld textarea:focus,
.fields input:focus, .fields select:focus {
  box-shadow: 0 0 0 3px var(--mint);
}
.fld textarea { resize: vertical; line-height: 1.45; }
.fld-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0 0.7rem; }
/* Grid/flex children default to min-width:auto, so a wide <select> option or
   long placeholder can push a field past the card edge. Let them shrink. */
.fld-row > .fld { min-width: 0; }
.fld input, .fld select, .fld textarea { min-width: 0; max-width: 100%; }
.fld select { text-overflow: ellipsis; }
.err { color: #b3261e; font-weight: 700; font-size: 0.9rem; margin: 0 0 0.7rem; }

/* ── Auth ───────────────────────────────────────────────────────────── */
.auth-hero { padding: 1.2rem 0 1.4rem; }
.auth-hero p { font-size: 1.05rem; margin: 0; max-width: 34rem; }
.auth-card { max-width: 460px; }
.seg {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem;
  background: var(--yellow); border: var(--line); border-radius: 12px;
  padding: 0.3rem; margin-bottom: 1rem;
}
.seg-btn {
  border: 0; background: transparent; border-radius: 9px;
  min-height: 40px; font-weight: 700; cursor: pointer;
}
.seg-btn.is-active { background: var(--ink); color: var(--yellow); }
.auth-fine { font-size: 0.82rem; opacity: 0.62; text-align: center; margin: 0.75rem 0 0; }
.linklike {
  display: block; margin: 0.7rem auto 0; background: none; border: 0;
  font-weight: 700; text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer; padding: 0.3rem 0.5rem;
}

/* ── Home / list ────────────────────────────────────────────────────── */
.home-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }
.pill {
  display: inline-block; font-size: 0.78rem; font-weight: 700;
  border: var(--line); border-radius: 999px; padding: 0.22rem 0.7rem;
  background: var(--white);
}
.pill-mint { background: var(--mint); }
.search-wrap {
  position: relative; margin: 0.9rem 0 0.7rem;
}
.search-wrap svg { position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%); opacity: 0.55; }
.search-wrap input {
  width: 100%; font-size: 16px;
  padding: 0.8rem 0.9rem 0.8rem 2.5rem;
  border: var(--line); border-radius: 13px;
  background: var(--white); outline: none; box-shadow: var(--shadow-sm);
}
.search-wrap input:focus { box-shadow: 0 0 0 3px var(--mint); }
.chips { display: flex; gap: 0.45rem; overflow-x: auto; padding: 0.2rem 0 0.55rem; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; font-size: 0.85rem; font-weight: 700;
  border: var(--line); border-radius: 999px;
  background: var(--white); padding: 0.42rem 0.85rem; cursor: pointer;
}
.chip.is-active { background: var(--ink); color: var(--yellow); }
.forms-list { display: grid; gap: 0.6rem; }
.form-item {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--white); border: var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 0.8rem 0.9rem;
  cursor: pointer; text-align: left; width: 100%;
}
.form-item:active { transform: translateY(2px); box-shadow: none; }
.form-item .t { font-weight: 700; }
.form-item .m { font-size: 0.8rem; opacity: 0.6; margin-top: 0.15rem; }
.form-item .grow { flex: 1; min-width: 0; }
.form-item svg { flex: 0 0 auto; opacity: 0.5; }
.badge-ai {
  flex: 0 0 auto; font-size: 0.68rem; font-weight: 900; letter-spacing: 0.04em;
  background: var(--mint); border: var(--line); border-radius: 7px; padding: 0.14rem 0.4rem;
}
.skeleton {
  height: 62px; border-radius: var(--radius);
  border: var(--line); background:
    linear-gradient(100deg, var(--white) 40%, var(--mint-soft) 50%, var(--white) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.1s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { opacity: 0.65; padding: 1.2rem 0; text-align: center; }

/* ── Form fill ──────────────────────────────────────────────────────── */
.backbtn {
  display: inline-flex; align-items: center; gap: 0.3rem;
  border: 0; background: transparent; font-weight: 700; cursor: pointer;
  padding: 0.25rem 0.25rem 0.25rem 0; margin-bottom: 0.4rem; opacity: 0.75;
}
.ctx-card { margin-top: 0.9rem; }
.ctx-actions { display: flex; gap: 0.6rem; justify-content: flex-end; align-items: center; }
.notes {
  border: var(--line); border-radius: 11px;
  background: var(--yellow);
  padding: 0.65rem 0.85rem; font-size: 0.92rem; margin: 0.9rem 0 0;
}
.fields { display: grid; gap: 0.7rem; }
.frow {
  background: var(--white); border: var(--line); border-radius: 12px;
  padding: 0.6rem 0.75rem;
}
.frow > label > span {
  display: block; font-size: 0.78rem; font-weight: 700; opacity: 0.75; margin-bottom: 0.25rem;
  overflow-wrap: anywhere;
}
.frow input[type="text"], .frow select {
  border: 0; padding: 0.15rem 0; border-radius: 0; background: transparent;
}
.frow input[type="text"]:focus, .frow select:focus { box-shadow: none; outline: none; }
.frow.is-kit { background: var(--mint-soft); }
.frow.is-ai { animation: aiflash 1.6s ease; background: var(--mint-soft); }
@keyframes aiflash { 0% { background: var(--mint); } }
.frow-check { display: flex; align-items: center; gap: 0.65rem; cursor: pointer; }
.frow-check input {
  width: 22px; height: 22px; accent-color: var(--ink); flex: 0 0 auto;
}
.frow-check span { font-size: 0.92rem; font-weight: 700; overflow-wrap: anywhere; }
.genbar {
  position: fixed; left: 0; right: 0;
  bottom: var(--tabbar-h);
  padding: 0.6rem var(--pad) 0.75rem;
  background: linear-gradient(transparent, var(--canvas) 35%);
  z-index: 30;
}
.genbar .btn { max-width: 680px; margin: 0 auto; display: flex; }

/* ── Kit ────────────────────────────────────────────────────────────── */
.kit-card { margin-top: 0.9rem; }
.sig-block { margin: 0.4rem 0 1rem; }
#sig-pad {
  width: 100%; height: 160px; display: block;
  border: var(--line); border-radius: 11px; background: var(--white);
  touch-action: none;
}
.sig-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 0.4rem; }
.sig-hint { font-size: 0.8rem; }

/* ── Searchable patient picker ──────────────────────────────────────── */
.patient-picker { position: relative; }
.ps-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  font-size: 16px; padding: 0.7rem 0.8rem;
  border: var(--line); border-radius: 11px; background: var(--white);
  cursor: pointer; text-align: left;
}
.ps-trigger:disabled { opacity: 0.55; cursor: default; }
.patient-picker.is-open .ps-trigger { box-shadow: 0 0 0 3px var(--mint); }
.ps-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; }
.ps-label.is-placeholder { opacity: 0.5; }
.ps-chev { flex: 0 0 auto; opacity: 0.5; font-size: 0.8rem; }
.ps-panel {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 50;
  background: var(--white); border: var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 0.5rem;
  max-height: min(58vh, 360px); display: flex; flex-direction: column;
}
.ps-search {
  width: 100%; font-size: 16px; padding: 0.55rem 0.7rem;
  border: var(--line); border-radius: 9px; background: var(--white);
  outline: none; margin-bottom: 0.4rem; flex: 0 0 auto;
}
.ps-search:focus { box-shadow: 0 0 0 3px var(--mint); }
.ps-list { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.ps-item {
  display: flex; flex-direction: column; gap: 0.1rem;
  padding: 0.6rem; border-radius: 9px; cursor: pointer;
}
.ps-item:active, .ps-item.is-sel { background: var(--mint-soft); }
@media (hover: hover) { .ps-item:hover { background: var(--mint-soft); } }
.ps-item-name { font-weight: 700; }
.ps-item-sub { font-size: 0.8rem; opacity: 0.6; }
.ps-new { font-weight: 700; }
.ps-more { padding: 0.55rem 0.6rem; font-size: 0.85rem; opacity: 0.6; }

/* ── Settings (in My kit) ───────────────────────────────────────────── */
.settings-card { display: grid; gap: 0.2rem; }
.settings-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.35rem 0;
}
.settings-row + .settings-row { border-top: 1px dashed rgba(29, 28, 28, 0.2); padding-top: 0.75rem; margin-top: 0.4rem; }
.settings-row > span { font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.settings-row .muted { font-weight: 400; }
.legal-links { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: flex-end; font-weight: 400; }
.legal-links a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }

/* ── Delete account (danger zone) ───────────────────────────────────── */
.danger-card { display: grid; gap: 0.7rem; }
.danger-card .muted { margin: 0; }
.btn-danger-ghost { color: #b42318; border-color: #b42318; justify-self: start; }
.delete-confirm { display: grid; gap: 0.7rem; border-top: 1px dashed rgba(29, 28, 28, 0.2); padding-top: 0.8rem; }
.delete-confirm p { margin: 0; font-weight: 700; }
.delete-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.delete-actions .btn { flex: 1; min-width: 130px; }

/* ── Réseau ─────────────────────────────────────────────────────────── */
.reseau-pitch p:first-child { font-size: 1.05rem; margin: 0 0 0.5rem; }
.reseau-join { display: grid; grid-template-columns: 1fr auto; gap: 0.6rem; margin-top: 0.9rem; }
.reseau-join select {
  font-size: 16px; padding: 0.6rem 0.7rem;
  border: var(--line); border-radius: 11px; background: var(--white); min-width: 0;
}
.counts { display: grid; gap: 0.5rem; }
.count-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--white); border: var(--line); border-radius: 12px;
  padding: 0.65rem 0.9rem; box-shadow: var(--shadow-sm);
}
.count-row .n {
  font-weight: 900; background: var(--mint);
  border: var(--line); border-radius: 999px; padding: 0.15rem 0.65rem;
}
.count-row.is-mine { background: var(--mint-soft); }

/* ── Tabbar ─────────────────────────────────────────────────────────── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--white);
  border-top: var(--line);
  padding: 0.35rem 0.5rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
  font-size: 0.7rem; font-weight: 700;
  padding: 0.3rem 0; border-radius: 10px; opacity: 0.55; min-height: 48px;
}
.tabbar a.is-active { opacity: 1; }
.tabbar a.is-active svg { background: var(--mint); border-radius: 8px; padding: 2px; margin: -2px; }

/* ── Toast ──────────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + 0.8rem);
  z-index: 60;
  background: var(--ink); color: var(--yellow);
  border-radius: 12px; padding: 0.7rem 1.1rem;
  font-weight: 700; box-shadow: var(--shadow-sm);
  max-width: min(92vw, 480px); text-align: center;
  animation: toastin 0.18s ease;
}
@keyframes toastin { from { transform: translateX(-50%) translateY(8px); opacity: 0; } }

/* ── Scribe ─────────────────────────────────────────────────────────── */
.consent-card { background: var(--yellow); margin-top: 0.9rem; }
.recover-card { background: var(--mint-soft); margin-top: 0.9rem; }
.live-search { margin-top: 0.9rem; }
.live-panel { margin-top: 0.9rem; }
.live-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.55rem; flex-wrap: wrap; }
.live-sub { font-size: 0.78rem; }
.live-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--ember);
  animation: pulse 1.2s ease infinite;
}
.live-chips { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.live-chip {
  font-size: 0.78rem; font-weight: 700; border: var(--line); border-radius: 999px;
  padding: 0.18rem 0.6rem; background: var(--mint-soft);
}
.live-item { font-size: 0.9rem; padding: 0.3rem 0; }
.live-item.flag { background: var(--yellow); border: var(--line); border-radius: 9px; padding: 0.4rem 0.6rem; margin: 0.3rem 0; font-weight: 700; }
.recover-card p { margin: 0 0 0.6rem; }
.consent-card p { margin: 0 0 0.6rem; }
.work-card { margin-top: 0.9rem; }
.work-card .scribe-patient-fld { margin: 0 0 0.85rem; }
.tpl-fld { margin: 0 0 0.85rem; }
/* Note templates (My kit) */
.tpl-intro { margin: 0.2rem 0 0.7rem; }
.tpl-list { margin-bottom: 0.7rem; }
.tpl-item.is-default { border-color: var(--green-dark); }
.tpl-body { white-space: pre-wrap; opacity: 0.85; }
.tpl-card { margin-top: 0.2rem; }
.tpl-actions { display: flex; gap: 0.6rem; justify-content: flex-end; }
.tpl-actions .btn { flex: 0 0 auto; }
.work-card .new-patient-row { margin: -0.35rem 0 0.85rem; }
.rec-row {
  display: flex; align-items: center; gap: 1rem;
  border-top: 1px dashed rgba(29, 28, 28, 0.25);
  padding-top: 0.85rem;
}

/* Recording mode: a focused page — hide the day board, title and picker so the
   recorder + reference search own the screen. */
#scribe-capture.is-recording .home-head,
#scribe-capture.is-recording #scribe-recent,
#scribe-capture.is-recording #consent-card,
#scribe-capture.is-recording #recover-card,
#scribe-capture.is-recording .scribe-patient-fld,
#scribe-capture.is-recording .new-patient-row,
#scribe-capture.is-recording .tpl-fld,
#scribe-capture.is-recording .pt-glance { display: none; }
#scribe-capture.is-recording .work-card { margin-top: 1.4rem; text-align: center; }
#scribe-capture.is-recording .rec-row {
  flex-direction: column; align-items: center; text-align: center;
  gap: 0.8rem; border-top: 0; padding-top: 0.5rem;
}
#scribe-capture.is-recording .recbtn { width: 96px; height: 96px; }
#scribe-capture.is-recording .rec-timer { font-size: 2.1rem; }
#scribe-capture.is-recording .rec-status { font-size: 1.15rem; }
#paste-card summary { font-weight: 700; cursor: pointer; opacity: 0.8; }
#paste-card .paste-fld { margin: 0.75rem 0 0.7rem; }
.note-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; margin: 0.2rem 0 0.4rem; }
.note-head-text { min-width: 0; }
.note-head h2 { margin: 0; }
#note-head-meta { font-size: 0.9rem; margin-top: 0.1rem; }
.note-del { flex: 0 0 auto; min-height: 38px; padding: 0.35rem 0.75rem; font-size: 0.85rem; margin-top: 0.2rem; }
#note-result .sect:first-of-type { margin-top: 1.1rem; }
#btn-note-form { margin-top: 0.7rem; }
.next-patient { margin-top: 1.6rem; }
.day-chips { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-top: 0.4rem; }
.day-chip {
  font-size: 0.7rem; font-weight: 900; letter-spacing: 0.03em;
  border: var(--line); border-radius: 999px; padding: 0.1rem 0.5rem;
  background: var(--white);
}
.day-chip.bill { background: var(--mint); }
.day-chip.warn { background: var(--yellow); }
.day-item { align-items: flex-start; }
.recbtn {
  flex: 0 0 auto;
  width: 74px; height: 74px; border-radius: 50%;
  border: var(--line); background: var(--mint);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: var(--shadow-sm);
}
.recbtn:active { transform: translateY(2px); box-shadow: none; }
.recbtn.is-rec { background: var(--ember); animation: pulse 1.1s ease infinite; }
.recbtn[disabled] { opacity: 0.5; pointer-events: none; }
.rec-status { font-weight: 700; }
.rec-timer { font-size: 1.6rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.note-card { padding: 0.4rem; }
.note-card textarea {
  width: 100%; border: 0; background: transparent; outline: none;
  font-size: 15px; line-height: 1.5; padding: 0.6rem; resize: vertical;
  font-family: inherit;
}
/* Voice/text edit bar under the note */
.note-edit-bar { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.7rem; }
.note-edit-bar input {
  flex: 1; min-width: 0; font-size: 16px; padding: 0.6rem 0.75rem;
  border: var(--line); border-radius: 11px; background: var(--white); outline: none;
}
.note-edit-bar input:focus { box-shadow: 0 0 0 3px var(--mint); }
.note-edit-mic { flex: 0 0 auto; }
.note-edit-mic.is-rec { background: var(--ember); animation: pulse 1.1s ease infinite; }
.note-edit-bar .btn { flex: 0 0 auto; }
.note-actions { display: flex; gap: 0.55rem; flex-wrap: wrap; margin-top: 0.7rem; }
.note-actions .btn { flex: 1 1 auto; }
.transcript-card { margin-top: 0.9rem; }
.transcript-card summary { font-weight: 700; cursor: pointer; }
.transcript-card pre {
  white-space: pre-wrap; font-family: inherit; font-size: 0.88rem;
  line-height: 1.45; margin: 0.6rem 0 0; opacity: 0.8;
}
.bill-line {
  display: flex; justify-content: space-between; gap: 0.6rem;
  padding: 0.45rem 0; border-bottom: 1px dashed rgba(29, 28, 28, 0.25);
}
.bill-line .c { font-weight: 900; }
.bill-line .d { flex: 1; min-width: 0; opacity: 0.8; font-size: 0.92rem; }
.bill-line .m { font-weight: 700; white-space: nowrap; }
.bill-total {
  display: flex; justify-content: space-between;
  padding-top: 0.6rem; font-weight: 900; font-size: 1.1rem;
}
.bill-reason { font-size: 0.85rem; opacity: 0.65; margin: 0.6rem 0 0; }
.bill-warn {
  border: var(--line); border-radius: 10px; background: var(--yellow);
  padding: 0.5rem 0.7rem; font-size: 0.85rem; margin-top: 0.6rem;
}
.cmq-hint { font-size: 0.85rem; font-weight: 700; margin: -0.35rem 0 0.75rem; }
.cmq-hint.ok { color: var(--green-dark); }
.cmq-hint.warn { color: #9a6b00; }
.kit-cmq { font-size: 0.85rem; font-weight: 700; color: var(--green-dark); margin: -0.4rem 0 0.8rem; }

/* ── Patients ───────────────────────────────────────────────────────── */
.patients-toolbar { display: flex; align-items: center; gap: 0.6rem; margin: 0.9rem 0 0.7rem; }
.patients-toolbar .search-wrap { flex: 1; margin: 0; min-width: 0; }
.addtoggle { flex: 0 0 auto; white-space: nowrap; }
.addtoggle .addtoggle-plus { transition: transform 0.15s ease; }
.addtoggle.is-open .addtoggle-plus { transform: rotate(45deg); }
.add-patient-card { margin: 0.2rem 0 0.9rem; }
.add-patient-card .fld-row { align-items: end; }
.add-patient-card > .btn-block { margin-bottom: 0; }
.fld em { font-style: normal; font-weight: 400; opacity: 0.55; }
.patient-item .m { font-size: 0.8rem; opacity: 0.6; margin-top: 0.15rem; }
.manual-note-card { margin-top: 0.9rem; }
/* A checkbox field sits on the input baseline of its row-mate, not the label. */
.fld-check { display: flex; flex-direction: column; }
.fld-check input {
  width: 26px; height: 26px; accent-color: var(--ink);
  margin: 0.35rem 0 0.85rem; flex: 0 0 auto;
}
.pt-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.5rem 0 0.3rem; }
.pt-glance {
  display: block; width: 100%; text-align: left; cursor: pointer;
  border: var(--line); border-radius: 11px; background: var(--mint-soft);
  padding: 0.5rem 0.7rem; margin: 0 0 0.2rem; font-size: 0.85rem; font-weight: 700;
  box-shadow: var(--shadow-sm);
}
.pt-glance:active { transform: translateY(2px); box-shadow: none; }
.glance-nudge { font-weight: 400; opacity: 0.7; }
.glance-go { opacity: 0.55; }
.notes-list { display: grid; gap: 0.7rem; }
.note-item {
  background: var(--white); border: var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 0.85rem 0.95rem;
}
.note-item .head {
  display: flex; align-items: center; gap: 0.55rem; margin-bottom: 0.45rem;
}
.note-item .date { font-weight: 700; font-size: 0.85rem; }
.badge-kind {
  font-size: 0.66rem; font-weight: 900; letter-spacing: 0.05em;
  border: var(--line); border-radius: 7px; padding: 0.12rem 0.4rem;
  background: var(--mint);
}
.badge-kind.manual { background: var(--white); }
.note-item .body {
  white-space: pre-wrap; font-size: 0.92rem; line-height: 1.45;
  max-height: 5.6em; overflow: hidden; position: relative;
}
.note-item.is-open .body { max-height: none; }
.note-item .body::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1.6em;
  background: linear-gradient(transparent, var(--white));
}
.note-item.is-open .body::after { display: none; }
.note-item .row-actions { display: flex; gap: 0.45rem; flex-wrap: wrap; margin-top: 0.6rem; }
.note-item .row-actions .btn { min-height: 38px; padding: 0.35rem 0.7rem; font-size: 0.85rem; }
.note-item audio { width: 100%; margin-top: 0.55rem; }
#note-audio { width: 100%; margin: 0.2rem 0 0.7rem; }
.assign-row { margin: 0.2rem 0 0.6rem; }
.assign-fld { margin-bottom: 0.4rem; }
.new-patient-row { display: grid; grid-template-columns: 1fr auto; gap: 0.5rem; }
.new-patient-row input {
  font-size: 16px; padding: 0.55rem 0.7rem;
  border: var(--line); border-radius: 11px; background: var(--white); outline: none;
}
.btn-danger { background: var(--ember); }

.card-scan-btn { width: 100%; margin-bottom: 0.35rem; }
.card-scan-hint { font-size: 0.78rem; opacity: 0.6; margin: 0 0 0.8rem; text-align: center; }
/* Patient add wizard */
.add-step-title { font-weight: 700; font-size: 0.95rem; margin: 0 0 0.7rem; }
.add-step-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem; }
.add-step-head .backbtn { margin: 0; }
.add-step-head .add-step-title { margin: 0; }
.add-step-actions { display: flex; gap: 0.6rem; margin-top: 0.4rem; }
.add-step-actions .btn { flex: 1; }
.card-thumbs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.2rem 0 0.7rem; }
.card-thumb { position: relative; width: 74px; height: 74px; }
.card-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  border: var(--line); border-radius: 10px; display: block;
}
.card-thumb-x {
  position: absolute; top: -8px; right: -8px;
  width: 24px; height: 24px; border-radius: 50%;
  border: var(--line); background: var(--white);
  font-size: 15px; font-weight: 900; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0;
  box-shadow: var(--shadow-sm);
}
.card-thumb-x:active { transform: translateY(1px); box-shadow: none; }
.card-ctx-note {
  border: var(--line); border-radius: 10px; background: var(--mint-soft);
  padding: 0.5rem 0.7rem; font-size: 0.85rem; font-weight: 700; margin: 0 0 0.8rem;
}
.kit-check { display: flex; flex-direction: row; align-items: center; gap: 0.65rem; margin: 0.2rem 0 1rem; }
.kit-check input { width: 22px; height: 22px; margin: 0; }

/* ── Évidences ──────────────────────────────────────────────────────── */
.scribe-patient-fld { margin: 0.9rem 0 0; }
.evidence-item { padding: 0.75rem 0.9rem; }
.ev-title { font-weight: 700; text-decoration: underline; text-underline-offset: 2px; display: block; }
.ev-source { font-size: 0.78rem; opacity: 0.6; margin-top: 0.2rem; }
.ev-why { font-size: 0.9rem; margin-top: 0.4rem; background: var(--mint-soft); border-radius: 8px; padding: 0.4rem 0.6rem; }
#evidence-result { margin-top: 0.4rem; }

/* ── Citations ──────────────────────────────────────────────────────── */
.src-chip {
  display: inline-block; font-size: 0.72rem; font-weight: 900; letter-spacing: 0.03em;
  border: var(--line); border-radius: 999px; padding: 0.12rem 0.55rem;
  background: var(--yellow); text-decoration: none; margin: 0 0.3rem 0.35rem 0;
}
a.src-chip:active { transform: translateY(1px); }
.src-chip--org { background: var(--mint); }
.live-refs { margin-top: 0.5rem; }
.note-forms {
  border: var(--line); border-radius: 12px; background: var(--mint-soft);
  padding: 0.7rem 0.85rem; margin: 0 0 0.7rem;
}
.note-forms-label { font-weight: 700; font-size: 0.88rem; display: block; margin-bottom: 0.45rem; }
.note-form-chip {
  display: block; width: 100%; text-align: left;
  border: var(--line); border-radius: 11px; background: var(--white);
  padding: 0.55rem 0.75rem; margin-bottom: 0.4rem; cursor: pointer;
  box-shadow: var(--shadow-sm); font-weight: 700;
}
.note-form-chip:active { transform: translateY(2px); box-shadow: none; }
.note-form-chip .why { display: block; font-weight: 400; font-size: 0.8rem; opacity: 0.65; margin-top: 0.15rem; }
/* Reference/library documents read as "hand to patient", not "fill" — soft tint. */
.note-doc-chip { background: var(--yellow-soft); }

/* Wider screens: breathe a little */
@media (min-width: 700px) {
  .forms-list { grid-template-columns: 1fr 1fr; }
  .form-item { padding: 0.95rem 1rem; }
}

/* ── Desktop: sidebar navigation + two-column workspaces ────────────── */
@media (min-width: 1024px) {
  /* Fixed app frame: the topbar + sidebar stay put, only the center column
     scrolls. position:fixed (not sticky) — Safari drops sticky when an ancestor
     has overflow, and body has overflow-x:clip, so sticky scrolled away there. */
  .topbar { position: fixed; top: 0; left: 0; right: 0; }
  #app { max-width: 1180px; padding-left: 220px; padding-top: calc(44px + 1.1rem); padding-bottom: 3rem; }
  .tabbar {
    top: 57px; bottom: 0; left: 0; right: auto; width: 200px;
    grid-template-columns: 1fr; grid-auto-rows: min-content; gap: 0.25rem;
    border-top: 0; border-right: var(--line);
    padding: 1rem 0.7rem; background: var(--canvas); align-content: start;
  }
  .tabbar a {
    flex-direction: row; justify-content: flex-start; gap: 0.7rem;
    font-size: 0.95rem; padding: 0.6rem 0.8rem; min-height: 0;
    border-radius: 11px;
  }
  .tabbar a.is-active { background: var(--white); border: var(--line); box-shadow: var(--shadow-sm); opacity: 1; }
  .tabbar a.is-active svg { background: none; padding: 0; margin: 0; }
  .genbar { left: 220px; bottom: 0; }
  .toast { bottom: 2rem; }
  :root { --tabbar-h: 0px; }
  /* Scribe capture: record + copilot on the left, the day board as a right rail */
  #scribe-capture { display: grid; grid-template-columns: 1fr 320px; gap: 0 1.4rem; align-items: start; }
  #scribe-capture > .home-head { grid-column: 1 / -1; }
  #scribe-capture > .consent-card, #scribe-capture > .recover-card, #scribe-capture > .work-card,
  #scribe-capture > #live-panel, #scribe-capture > .ctx-card { grid-column: 1; }
  #scribe-capture > #scribe-recent { grid-column: 2; grid-row: 2 / 99; position: sticky; top: 75px; margin: 0; }
  #scribe-recent .forms-list { grid-template-columns: 1fr; }
  /* Note workspace: a focused single column */
  #note-result { max-width: 760px; margin: 0 auto; }
  /* Form fill: fields left, context sticky right */
  #view-form { display: grid; grid-template-columns: 1fr 340px; gap: 0 1.4rem; align-items: start; }
  #view-form > .backbtn, #view-form > h2, #view-form > #f-meta { grid-column: 1 / -1; }
  #view-form > .scribe-patient-fld, #view-form > #f-notes, #view-form > .sect,
  #view-form > #f-fields, #view-form > #pdf-actions, #view-form > #fax-row { grid-column: 1; }
  #view-form > .ctx-card { grid-column: 2; position: sticky; top: 75px; margin-top: 0.9rem; }
  .fields { grid-template-columns: 1fr 1fr; gap: 0.7rem; }
  .frow { align-self: start; }
  /* Patient dossier: chart info left, notes right-wide */
  .counts { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
}

.otp-sent-to { margin: 0 0 0.8rem; }

/* ── invite code (signup) ─────────────────────────────────────────── */
.code-input { text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }

/* ── invitations (viral loop, in My kit) ──────────────────────────── */
.invite-list { display: flex; flex-direction: column; gap: 0.55rem; margin-bottom: 0.4rem; }
.invite-row {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.7rem 0.85rem; margin: 0;
}
.invite-code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-weight: 700; letter-spacing: 0.05em; font-size: 1.02rem;
  flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.invite-row.is-used { opacity: 0.55; }
.invite-row.is-used .invite-code { text-decoration: line-through; }
.invite-tag { font-size: 0.82rem; color: var(--muted, #6b6b60); font-weight: 600; }
.invite-copy { flex: 0 0 auto; padding: 0.45rem 0.7rem; font-size: 0.86rem; }
.invite-share { flex: 0 0 auto; }

/* ── PDF preview (filled form) ────────────────────────────────────── */
.pdf-frame {
  width: 100%; height: 62vh; margin-top: 0.7rem;
  border: 1px solid var(--line, #e4e4dc); border-radius: 14px; background: #fff;
}

/* ── shared document library ───────────────────────────────────────── */
.doc-add {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  width: 100%; margin: 0.1rem 0 0.9rem; padding: 0.75rem 1rem;
  border: 1.5px dashed var(--line, #d8d8cf); border-radius: 14px;
  background: transparent; color: var(--ink, #1a1a17); font: inherit; font-weight: 600;
  cursor: pointer;
}
.doc-add:hover { border-color: var(--ink, #1a1a17); background: rgba(0,0,0,0.025); }
.linklike.danger { color: #b42318; margin-top: 1.1rem; display: inline-block; }

/* ── language selector (segmented, shows current) ─────────────────── */
.lang-seg { display: inline-flex; border: 1.5px solid var(--line, #d8d8cf); border-radius: 999px; overflow: hidden; background: #fff; }
.lang-seg .lang-opt {
  border: 0; background: transparent; padding: 0.32rem 0.72rem;
  font: inherit; font-weight: 600; font-size: 0.85rem; line-height: 1;
  color: var(--muted, #6b6b60); cursor: pointer;
}
.lang-seg .lang-opt.is-active { background: var(--ink, #1a1a17); color: #fff; }

/* ── auth: invite gate first, sign-in demoted ─────────────────────── */
.auth-badge {
  display: inline-block; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: #10714a; background: #DCF3E7;
  padding: 0.34rem 0.72rem; border-radius: 999px; margin-bottom: 0.9rem;
}
.gate-fld { margin-bottom: 0.4rem; }
.gate-fld .code-input {
  font-size: 1.65rem; text-align: center; letter-spacing: 0.32em;
  padding: 0.8rem 0.5rem; font-weight: 700;
}
.gate-fld .code-input::placeholder { letter-spacing: 0.32em; color: #cfcec4; }
.code-confirm {
  display: inline-flex; align-items: center; gap: 0.35rem;
  border: 1px solid var(--line, #e4e3db); background: transparent;
  border-radius: 999px; padding: 0.34rem 0.7rem; margin: 0 0 1rem;
  font: inherit; font-size: 0.82rem; color: var(--muted, #6e6c60); cursor: pointer;
}
.code-confirm:hover { border-color: var(--ink, #1a1a17); color: var(--ink, #1a1a17); }
.code-confirm b { color: var(--ink, #1a1a17); font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.05em; }
.auth-switch { text-align: center; margin-top: 1.15rem; }
.auth-switch .linklike { font-size: 0.9rem; }

/* confirm-your-details step */
.confirm-lead { font-weight: 650; font-size: 1.05rem; margin: 0.1rem 0 0.5rem; }

/* signature: tap-to-open control + fullscreen rotated (landscape) pad */
.sig-open {
  display: flex; align-items: center; gap: 0.6rem; width: 100%;
  border: 1.5px dashed var(--line, #d8d8cf); border-radius: 14px; background: transparent;
  padding: 0.85rem 1rem; font: inherit; font-weight: 600; color: var(--ink, #1a1a17); cursor: pointer;
}
.sig-open:hover { border-color: var(--ink, #1a1a17); }
.sig-open.is-signed { border-style: solid; border-color: #2fa574; }
.sig-thumb { height: 38px; width: auto; max-width: 130px; background: #fff; border: 1px solid var(--line, #e4e3db); border-radius: 6px; }

/* Fullscreen landscape signature (rotated 90° so a portrait phone signs wide).
   Scroll is killed by a document-level touchmove blocker + body lock in JS. */
.sig-modal { position: fixed; inset: 0; z-index: 3000; background: #ffffff; overflow: hidden; touch-action: none; overscroll-behavior: none; }
.sig-modal-rot {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%) rotate(90deg); transform-origin: center;
  display: flex; flex-direction: column; gap: 12px; padding: 16px; box-sizing: border-box;
  touch-action: none;
}
/* Landscape screens (desktop, or a phone already held sideways) sign flat — no rotation. */
.sig-modal-rot.is-flat { transform: translate(-50%, -50%); }
.sig-modal-hint { text-align: center; font-size: 0.9rem; color: var(--muted, #6e6c60); }
.sig-modal-pad { display: block; background: #fff; border: 1.5px solid var(--ink, #1d1c1c); border-radius: 14px; touch-action: none; }
.sig-modal-bar { display: flex; gap: 10px; }
.sig-modal-bar .btn { flex: 1; }
html.sig-locked, html.sig-locked body { overflow: hidden !important; overscroll-behavior: none; }

/* invite-gate hint: who invited you (green) / bad code (red) */
.gate-hint { margin: -0.3rem 0 0.7rem; font-size: 0.9rem; font-weight: 700; }
.gate-hint.is-good { color: var(--green-dark, #158460); }
.gate-hint.is-bad { color: #b3261e; }
#permit-inviter { margin: 0.1rem 0 0.9rem; }

/* Prevent pull-to-refresh from reloading (and wiping in-progress onboarding). */
html { overscroll-behavior-y: contain; }
body { overscroll-behavior-y: contain; }

/* signup consent line — visible before account creation (App Store / PHI) */
.auth-consent { font-size: 0.8rem; opacity: 0.68; text-align: center; margin: 0.9rem 0 0; line-height: 1.4; }
.auth-consent a { text-decoration: underline; text-underline-offset: 2px; font-weight: 700; }

/* Boot splash — same wordmark-on-canvas as the iOS launch image, so launch → app
   is one continuous clean splash (no bg+icon flip). Removed once the app is ready. */
#boot-splash {
  position: fixed; inset: 0; z-index: 5000;
  display: flex; align-items: center; justify-content: center;
  background: var(--canvas);
  transition: opacity 0.35s ease;
}
#boot-splash img { width: 56%; max-width: 340px; height: auto; }
#boot-splash.hide { opacity: 0; pointer-events: none; }

/* Inline "≥500 registered patients?" prompt in the billing result — turns the
   "non renseigné" warning into a one-tap Oui/Non that re-codes the claim. */
.panel-prompt{
  margin-top:.6rem; padding:.7rem .85rem;
  border:var(--line); border-radius:12px; background:var(--yellow-soft);
}
.panel-prompt__q{ margin:0; font-weight:700; }
.panel-prompt__hint{ margin:.15rem 0 .55rem; font-size:.8rem; opacity:.7; }
.panel-prompt__btns{ display:flex; gap:.5rem; }
.panel-prompt__btn{
  flex:1; border:var(--line); border-radius:999px; background:var(--white);
  padding:.45rem .8rem; font:inherit; font-weight:700; cursor:pointer;
  box-shadow:var(--shadow-sm);
}
.panel-prompt__btn:hover{ background:var(--yellow); }
.panel-prompt__btn:active{ transform:translateY(1px); box-shadow:none; }

/* ── Concierge demo (the onboarding call pilots the screen) ─────────── */
.demo-banner {
  position: fixed; left: 50%; transform: translateX(-50%);
  top: max(0.7rem, env(safe-area-inset-top));
  z-index: 70;
  background: var(--ink); color: var(--yellow);
  border-radius: 999px; padding: 0.45rem 1rem;
  font-weight: 700; font-size: 0.85rem;
  box-shadow: var(--shadow-sm);
  max-width: 92vw; text-align: center; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  animation: toastin 0.18s ease;
}
.demo-finger {
  position: fixed; left: 50%; top: 78%;
  z-index: 71; pointer-events: none;
  width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #fff 0 18%, var(--mint) 60%);
  border: var(--line);
  box-shadow: var(--shadow-sm);
  transition: left 0.8s cubic-bezier(0.3, 0.9, 0.3, 1), top 0.8s cubic-bezier(0.3, 0.9, 0.3, 1);
}
.demo-finger.is-press { animation: demopress 0.45s ease; }
@keyframes demopress {
  35% { transform: scale(0.62); box-shadow: 0 0 0 var(--ink), 0 0 0 10px rgba(120, 229, 174, 0.55); }
}
.demo-caption {
  margin-top: 0.9rem;
  background: var(--mint-soft);
  font-weight: 600; line-height: 1.45;
}
.demo-glow {
  animation: demoglow 2.6s ease;
  border-radius: 12px;
}
@keyframes demoglow {
  0%, 60% { box-shadow: 0 0 0 4px var(--mint), var(--shadow-sm); }
}
