/* =============================================================================
   QLive — appointments layer
   Patient booking, reception's request inbox, the expected list, the fee gate.
   Loaded after demo.css. It only adds; every colour comes from demo.css tokens
   so both themes are handled without a second palette.
   ========================================================================== */

/* -----------------------------------------------------------------------------
   Shared: the phone field. One number is the whole identity, so it earns a
   proper control rather than a bare input.
   -------------------------------------------------------------------------- */
.phone-row {
  display: flex; align-items: stretch;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
  transition: border-color .18s var(--ease-soft), box-shadow .18s var(--ease-soft);
}
.phone-row:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
.phone-cc {
  display: flex; align-items: center; padding: 0 .7rem;
  font-family: var(--font-mono); font-size: .82rem; font-weight: 600;
  color: var(--muted); background: var(--surface-2);
  border-right: 1px solid var(--line);
}
.phone-row .input {
  border: 0; border-radius: 0; background: transparent;
  flex: 1; min-width: 0; letter-spacing: .07em;
}
.phone-row .input:focus { box-shadow: none; border-color: transparent; }

/* -----------------------------------------------------------------------------
   Patient booking flow
   -------------------------------------------------------------------------- */
.bk-card {
  max-width: 30rem; margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(1.15rem, 4vw, 1.75rem);
  box-shadow: var(--shadow-md);
}
.bk-card h2 { margin: 0 0 .3rem; }
.bk-card.is-good { border-color: color-mix(in srgb, var(--ok) 34%, transparent); text-align: center; }
.bk-card.is-warn { border-color: color-mix(in srgb, var(--amber) 40%, transparent); text-align: center; }
.bk-card.is-good .bk-summary, .bk-card.is-warn .bk-summary { text-align: left; }

.bk-enter { animation: bkIn .5s var(--ease) both; }
@keyframes bkIn {
  from { transform: translateY(14px) scale(.985); }
  to   { transform: none; }
}

.bk-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: .75rem;
}

.bk-icon {
  width: 3rem; height: 3rem; border-radius: 50%;
  display: grid; place-items: center; margin: 0 auto .8rem;
}
.bk-icon.is-good {
  background: color-mix(in srgb, var(--ok) 13%, transparent); color: var(--ok);
  animation: bkPop .55s var(--ease-out-back) both;
}
.bk-icon.is-warn {
  background: color-mix(in srgb, var(--amber) 14%, transparent); color: var(--amber);
  animation: bkPop .55s var(--ease-out-back) both;
}
@keyframes bkPop { from { transform: scale(.4); opacity: 0; } }

/* --- previous visits teaser --- */
.bk-history-toggle {
  display: flex; align-items: center; gap: .45rem; width: 100%;
  margin-top: .85rem; padding: .55rem .7rem;
  font-family: var(--font-body); font-size: .82rem; font-weight: 550;
  color: var(--brand-text); background: var(--brand-tint);
  border: 1px solid transparent; border-radius: var(--r-md);
  cursor: pointer; text-align: left;
  transition: background .16s var(--ease-soft), border-color .16s var(--ease-soft);
}
.bk-history-toggle:hover { border-color: color-mix(in srgb, var(--brand) 30%, transparent); }
.bk-history { margin-top: .45rem; }
.bk-hist-row {
  display: grid; grid-template-columns: auto 1fr auto;
  gap: .6rem; padding: .5rem .15rem; font-size: .82rem;
  border-bottom: 1px solid var(--line-soft);
}
.bk-hist-row:last-child { border-bottom: 0; }
.bk-hist-row .faint { color: var(--faint); }

/* --- doctor picker --- */
.bk-doctors { display: grid; gap: .5rem; }
.bk-doc {
  display: flex; align-items: center; gap: .7rem;
  padding: .65rem .75rem; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color .16s var(--ease-soft), background .16s var(--ease-soft),
              transform .22s var(--ease-spring);
}
.bk-doc:hover { border-color: var(--brand-200); transform: translateY(-1px); }
.bk-doc.is-on { border-color: var(--brand); background: var(--brand-tint); }
.bk-doc span:last-child { display: flex; flex-direction: column; min-width: 0; }
.bk-doc strong { font-family: var(--font-display); font-size: .9rem; }
.bk-doc small { color: var(--muted); font-size: .76rem; }
.bk-doc-avatar {
  width: 2.1rem; height: 2.1rem; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--brand-tint); color: var(--brand-text);
  font-family: var(--font-display); font-weight: 700; font-size: .72rem;
}

/* --- day + slot pickers --- */
.bk-days { display: flex; gap: .4rem; flex-wrap: wrap; }
.bk-day {
  flex: 1 1 auto; min-width: 5rem; padding: .5rem .6rem;
  font-family: var(--font-body); font-size: .82rem; font-weight: 600;
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r-md);
  cursor: pointer; transition: all .16s var(--ease-soft);
}
.bk-day:hover { border-color: var(--brand-200); color: var(--brand-text); }
.bk-day.is-on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }

.bk-hint { float: right; font-weight: 500; color: var(--faint); font-size: .74rem; }

.bk-slots {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(4.6rem, 1fr));
  gap: .4rem; max-height: 15rem; overflow-y: auto; padding: .15rem;
}
.bk-slot {
  padding: .5rem .3rem;
  font-family: var(--font-mono); font-size: .74rem; font-weight: 600;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  cursor: pointer; transition: all .14s var(--ease-soft);
}
.bk-slot:hover:not(:disabled) { border-color: var(--brand); color: var(--brand-text); }
.bk-slot.is-on {
  background: var(--brand); border-color: var(--brand); color: var(--on-brand);
  box-shadow: 0 3px 12px -3px var(--brand);
  animation: bkSlotPick .34s var(--ease-out-back);
}
@keyframes bkSlotPick { from { transform: scale(.9); } }
.bk-slot.is-taken, .bk-slot:disabled {
  opacity: .36; cursor: not-allowed;
  text-decoration: line-through; text-decoration-thickness: 1px;
}
.bk-empty {
  grid-column: 1 / -1; margin: 0; padding: .9rem; text-align: center;
  color: var(--muted); font-size: .82rem;
  background: var(--surface-2); border-radius: var(--r-md);
}

/* --- summary block --- */
.bk-summary {
  margin-top: 1rem; padding: .5rem .85rem;
  background: var(--surface-2); border-radius: var(--r-md);
}
.bk-summary > div {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .4rem 0; font-size: .84rem;
  border-bottom: 1px solid var(--line-soft);
}
.bk-summary > div:last-child { border-bottom: 0; }
.bk-summary span { color: var(--muted); }
.bk-fee { color: var(--amber); }

/* --- waiting for reception to answer --- */
.bk-pending { text-align: center; }
.bk-pulse {
  display: flex; justify-content: center; align-items: center;
  gap: .4rem; height: 2.5rem; margin-bottom: .85rem;
}
.bk-pulse span {
  width: .6rem; height: .6rem; border-radius: 50%; background: var(--brand);
  animation: bkBounce 1.1s var(--ease-soft) infinite;
}
.bk-pulse span:nth-child(2) { animation-delay: .16s; }
.bk-pulse span:nth-child(3) { animation-delay: .32s; }
@keyframes bkBounce {
  0%, 70%, 100% { transform: translateY(0) scale(.8); opacity: .4; }
  35%           { transform: translateY(-9px) scale(1); opacity: 1; }
}
.bk-waitline {
  display: inline-flex; align-items: center; gap: .45rem;
  margin-top: 1rem; padding: .45rem .85rem;
  font-size: .82rem; color: var(--brand-text);
  background: var(--brand-tint); border-radius: var(--r-pill);
}

/* --- the counter-offer --- */
.bk-offer {
  display: grid; gap: .1rem; justify-items: center;
  margin-top: 1rem; padding: 1rem;
  background: var(--brand-tint);
  border: 1px dashed color-mix(in srgb, var(--brand) 40%, transparent);
  border-radius: var(--r-md);
}
.bk-offer-label {
  font-size: .68rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .12em;
}
.bk-offer-time {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(1.6rem, 7vw, 2.2rem); line-height: 1;
  color: var(--brand-text); font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
}
.bk-offer-day { font-size: .82rem; color: var(--muted); }

/* --- confirmed --- */
.bk-when { display: grid; gap: .1rem; justify-items: center; margin: 1rem 0 .25rem; }
.bk-when-day {
  font-size: .7rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .12em;
}
.bk-when-time {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(2rem, 9vw, 2.9rem); line-height: 1;
  letter-spacing: -.04em; font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.bk-note {
  display: flex; gap: .5rem; align-items: flex-start;
  margin-top: .85rem; padding: .7rem .8rem; text-align: left;
  font-size: .76rem; line-height: 1.55; color: var(--muted);
  background: var(--surface-2); border-radius: var(--r-md);
}
.bk-note svg { flex: none; margin-top: .12rem; color: var(--amber); }
.bk-err { margin: .4rem 0 0; font-size: .76rem; color: var(--rose); }

/* -----------------------------------------------------------------------------
   Reception: the request inbox
   -------------------------------------------------------------------------- */
.rq-empty {
  display: grid; justify-items: center; gap: .25rem;
  padding: 2rem 1rem; text-align: center; color: var(--muted);
}
.rq-empty svg { color: var(--line-strong); margin-bottom: .35rem; }
.rq-empty p {
  margin: 0; font-family: var(--font-display); font-weight: 600;
  color: var(--ink); font-size: .9rem;
}
.rq-empty small { font-size: .76rem; color: var(--faint); }

.rq {
  padding: .8rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: var(--r-md);
  animation: rqIn .45s var(--ease) both;
}
.rq + .rq { margin-top: .55rem; }
@keyframes rqIn {
  from { transform: translateX(-12px); }
  to   { transform: none; }
}
.rq.is-going { animation: rqOut .22s var(--ease-soft) forwards; }
@keyframes rqOut { to { opacity: 0; transform: translateX(26px) scale(.97); } }

.rq-top { display: flex; align-items: center; gap: .6rem; }
.rq-avatar {
  width: 2rem; height: 2rem; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--brand-tint); color: var(--brand-text);
  font-family: var(--font-display); font-weight: 700; font-size: .7rem;
}
.rq-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rq-who strong { font-family: var(--font-display); font-size: .88rem; }
.rq-who small { color: var(--muted); font-size: .74rem; }
.rq-age { font-size: .72rem; color: var(--faint); white-space: nowrap; }

.rq-slot {
  display: flex; align-items: center; gap: .45rem; flex-wrap: wrap;
  margin-top: .6rem; padding: .45rem .6rem;
  font-size: .84rem; color: var(--brand-text);
  background: var(--brand-tint); border-radius: var(--r-sm);
}
.rq-slot svg { flex: none; }
.rq-slot .faint { margin-left: auto; color: var(--muted); font-size: .74rem; }
.rq-warn {
  display: flex; align-items: center; gap: .3rem;
  margin: .45rem 0 0; font-size: .74rem; color: var(--amber);
}
.rq-actions { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .65rem; }
.rq-actions .btn { flex: 1 1 auto; }

/* the count badge on a tab or heading */
[data-req-count] {
  display: inline-grid; place-items: center;
  min-width: 1.2rem; height: 1.2rem; padding: 0 .35rem; margin-left: .35rem;
  font-family: var(--font-display); font-weight: 700; font-size: .68rem;
  color: var(--on-brand); background: var(--brand);
  border-radius: var(--r-pill);
  animation: badgePop .34s var(--ease-out-back);
}
[data-req-count].is-zero { background: var(--surface-3); color: var(--faint); }
@keyframes badgePop { from { transform: scale(.5); } }

/* -----------------------------------------------------------------------------
   Reception: expected today
   -------------------------------------------------------------------------- */
.exp {
  display: grid; grid-template-columns: auto 1fr auto auto;
  align-items: center; gap: .75rem;
  padding: .6rem .7rem;
  border-bottom: 1px solid var(--line-soft);
}
.exp:last-child { border-bottom: 0; }
.exp-time {
  font-family: var(--font-mono); font-weight: 600; font-size: .8rem;
  padding: .4rem .5rem; white-space: nowrap;
  background: var(--surface-2); border-radius: var(--r-sm);
}
.exp-who { min-width: 0; display: flex; flex-direction: column; }
.exp-who strong { font-family: var(--font-display); font-size: .88rem; }
.exp-who small {
  color: var(--muted); font-size: .74rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.exp-state { display: flex; flex-direction: column; align-items: flex-end; gap: .1rem; }
.exp-state b { font-size: .76rem; font-weight: 600; color: var(--muted); }
.exp-fee { font-size: .7rem; font-style: normal; color: var(--amber); }
.exp-actions { display: flex; align-items: center; gap: .35rem; }

.exp.is-late .exp-time {
  background: color-mix(in srgb, var(--amber) 14%, transparent); color: var(--amber);
}
.exp.is-late .exp-state b { color: var(--amber); }
.exp.is-urgent .exp-time {
  background: color-mix(in srgb, var(--rose) 14%, transparent); color: var(--rose);
  animation: expNudge 2.6s var(--ease-soft) infinite;
}
.exp.is-urgent .exp-state b { color: var(--rose); }
@keyframes expNudge {
  0%, 88%, 100% { transform: none; }
  92%           { transform: translateX(-2px); }
  96%           { transform: translateX(2px); }
}

/* -----------------------------------------------------------------------------
   The fee gate
   -------------------------------------------------------------------------- */
.fee-who {
  display: flex; align-items: center; gap: .7rem;
  padding-bottom: .8rem; margin-bottom: .8rem;
  border-bottom: 1px solid var(--line);
}
.fee-who div { display: flex; flex-direction: column; min-width: 0; }
.fee-who strong { font-family: var(--font-display); font-size: 1rem; }
.fee-who small { color: var(--muted); font-size: .76rem; }
.fee-avatar {
  width: 2.4rem; height: 2.4rem; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--brand-tint); color: var(--brand-text);
  font-family: var(--font-display); font-weight: 700; font-size: .8rem;
}
.fee-ask { margin: 0; font-size: .86rem; color: var(--muted); line-height: 1.6; }

.fee-choice { display: grid; gap: .5rem; margin-top: .9rem; }
.fee-opt {
  display: flex; align-items: center; gap: .7rem;
  padding: .75rem .8rem; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color .16s var(--ease-soft), transform .22s var(--ease-spring);
}
.fee-opt:hover { border-color: var(--brand); transform: translateY(-1px); }
.fee-opt span:last-child { display: flex; flex-direction: column; }
.fee-opt strong { font-family: var(--font-display); font-size: .9rem; }
.fee-opt small { color: var(--muted); font-size: .76rem; }
.fee-opt-ic {
  width: 2.1rem; height: 2.1rem; flex: none; border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: var(--surface-2); color: var(--muted);
}
.fee-opt.is-danger:hover { border-color: var(--rose); }
.fee-opt.is-danger:hover .fee-opt-ic {
  background: color-mix(in srgb, var(--rose) 12%, transparent); color: var(--rose);
}

/* -----------------------------------------------------------------------------
   Patient screen additions
   -------------------------------------------------------------------------- */
.pv-paid { color: var(--ok); display: inline-flex; align-items: center; gap: .25rem; }
.pv-history {
  margin-top: 1rem; padding: .85rem;
  background: var(--surface-2); border-radius: var(--r-md);
}
.pv-history h3 {
  margin: 0 0 .5rem; font-size: .68rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .12em;
}
.pv-hist-row {
  display: grid; grid-template-columns: auto 1fr; gap: .1rem .7rem;
  padding: .45rem 0; font-size: .84rem;
  border-bottom: 1px solid var(--line-soft);
}
.pv-hist-row:last-child { border-bottom: 0; }
.pv-hist-date { font-family: var(--font-mono); font-size: .76rem; color: var(--muted); }
.pv-hist-doc { font-weight: 600; }
.pv-hist-meta { grid-column: 2; font-size: .74rem; color: var(--faint); }

@media (max-width: 560px) {
  .exp { grid-template-columns: auto 1fr; row-gap: .5rem; }
  .exp-state {
    grid-column: 1 / -1; flex-direction: row;
    align-items: center; justify-content: space-between;
  }
  .exp-actions { grid-column: 1 / -1; }
  .exp-actions .btn { flex: 1; }
}

/* -----------------------------------------------------------------------------
   Patient page: track / book switch
   -------------------------------------------------------------------------- */
.pt-tabs {
  display: flex; gap: .25rem; padding: .25rem;
  margin-bottom: 1rem;
  background: var(--surface-2); border-radius: var(--r-pill);
}
.pt-tab {
  flex: 1; padding: .55rem .5rem;
  font-family: var(--font-body); font-size: .82rem; font-weight: 600;
  color: var(--muted); background: transparent;
  border: 0; border-radius: var(--r-pill); cursor: pointer;
  transition: color .18s var(--ease-soft), background .18s var(--ease-soft),
              box-shadow .18s var(--ease-soft);
}
.pt-tab:hover { color: var(--text); }
.pt-tab.is-on {
  color: var(--brand-text); background: var(--surface);
  box-shadow: var(--shadow-xs);
}

/* -----------------------------------------------------------------------------
   The fee explainer on the reception page — this is the sales argument, so it
   reads like prose rather than a settings list.
   -------------------------------------------------------------------------- */
.fee-explain {
  margin: 0; padding-left: 1.15rem;
  display: grid; gap: .65rem;
  font-size: .84rem; line-height: 1.6; color: var(--muted);
}
.fee-explain li::marker { color: var(--brand); font-weight: 700; }
.fee-explain strong { color: var(--ink); font-weight: 600; }

/* A toast that carries a follow-up action */
.toast-action {
  margin-left: .5rem; padding: .25rem .55rem; white-space: nowrap;
  font-size: .76rem; font-weight: 600; text-decoration: none;
  color: #fff; background: var(--whatsapp);
  border-radius: var(--r-pill);
  transition: filter .16s var(--ease-soft);
}
.toast-action:hover { filter: brightness(1.08); }

/* -----------------------------------------------------------------------------
   Trust signals — verification, codes, blocking
   -------------------------------------------------------------------------- */
.rq-trust {
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
  margin-top: .5rem;
}
.rq-badge {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .18rem .45rem;
  font-size: .68rem; font-weight: 600;
  border-radius: var(--r-xs);
}
.rq-badge.is-ok {
  color: var(--ok);
  background: color-mix(in srgb, var(--ok) 12%, transparent);
}
.rq-badge.is-warn {
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 13%, transparent);
}
.rq-code {
  margin-left: auto;
  font-family: var(--font-mono); font-size: .7rem; letter-spacing: .06em;
  color: var(--muted);
  padding: .18rem .4rem;
  background: var(--surface-2); border-radius: var(--r-xs);
}
.icon-btn.is-danger { color: var(--rose); }
.icon-btn.is-danger:hover {
  background: color-mix(in srgb, var(--rose) 12%, transparent);
  border-color: color-mix(in srgb, var(--rose) 30%, transparent);
}

/* The verification step on the patient's side */
.bk-code {
  display: grid; gap: .15rem; justify-items: center;
  margin-top: 1rem; padding: .85rem;
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
}
.bk-code span {
  font-size: .68rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .12em;
}
.bk-code strong {
  font-family: var(--font-mono); font-size: 1.6rem; font-weight: 700;
  letter-spacing: .08em; color: var(--ink);
}
.btn-wa {
  background: var(--whatsapp); color: #fff; border-color: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
}
.btn-wa:hover { filter: brightness(1.06); color: #fff; }
.bk-verified {
  display: flex; align-items: center; justify-content: center; gap: .3rem;
  margin-top: .6rem; font-size: .78rem; color: var(--ok);
}

/* The honest verification states. "Says they messaged you" is a claim the
   patient's browser made; only "Number confirmed" is evidence. */
.rq-badge.is-info {
  color: var(--sky);
  background: color-mix(in srgb, var(--sky) 13%, transparent);
}
.rq-check {
  margin: .5rem 0 0;
  padding: .5rem .6rem;
  font-size: .74rem; line-height: 1.5; color: var(--muted);
  background: var(--surface-2);
  border-radius: var(--r-sm);
}
.rq-check b { color: var(--ink); font-family: var(--font-mono); letter-spacing: .04em; }
.rq-check .btn { margin-top: .45rem; width: 100%; }

.bk-claimed {
  display: flex; align-items: center; justify-content: center; gap: .3rem;
  margin-top: .7rem; font-size: .8rem; color: var(--sky);
}
.bk-claimed b { font-family: var(--font-mono); letter-spacing: .05em; }

/* -----------------------------------------------------------------------------
   THE FEE DIALOG
   Amount, a scannable code, and how it was taken — one screen, because a
   second screen means a second queue at the counter.
   -------------------------------------------------------------------------- */
.fee-amount {
  display: grid; justify-items: center; gap: .2rem;
  margin: .9rem 0; padding: .9rem;
  background: var(--surface-2); border-radius: var(--r-md);
}
.fee-amount-label {
  font-size: .68rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .12em;
}
.fee-amount-row { display: flex; align-items: baseline; gap: .15rem; }
.fee-cur {
  font-family: var(--font-display); font-weight: 700;
  font-size: 1.5rem; color: var(--muted);
}
.fee-input {
  width: 5.5ch; padding: 0; border: 0; background: transparent;
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(2rem, 8vw, 2.6rem); line-height: 1.05;
  letter-spacing: -.03em; color: var(--ink);
  text-align: left; font-variant-numeric: tabular-nums;
  border-bottom: 2px dashed var(--line-strong);
}
.fee-input:focus { outline: none; border-bottom-color: var(--brand); }
.fee-amount-note { font-size: .72rem; color: var(--faint); text-align: center; }

/* The patient scans this from the other side of the counter, sometimes at
   arm's length with a cheap phone camera. Small is the wrong default: the code
   leads the panel and the copy sits under it. */
.fee-pay {
  display: flex; flex-direction: column; align-items: center; gap: .7rem;
  padding: 1rem .8rem; margin-bottom: .9rem;
  text-align: center;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface-2);
}
.fee-qr {
  width: clamp(190px, 52vw, 240px);
  height: clamp(190px, 52vw, 240px);
  flex: none;
  background: #fff; padding: 10px; border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.fee-qr svg { display: block; width: 100%; height: 100%; }
.fee-pay-copy {
  display: flex; flex-direction: column; align-items: center; gap: .18rem;
  min-width: 0;
}
.fee-pay-copy strong { font-family: var(--font-display); font-size: 1rem; }
.fee-pay-copy span { font-size: .8rem; color: var(--muted); line-height: 1.45; max-width: 34ch; }
.fee-pay-copy code {
  margin-top: .35rem; padding: .25rem .55rem;
  font-family: var(--font-mono); font-size: .78rem; letter-spacing: .02em;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-xs);
  color: var(--brand-text);
  overflow-wrap: anywhere;
}

.fee-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.fee-mode {
  display: flex; flex-direction: column; align-items: center; gap: .25rem;
  padding: .6rem .3rem; cursor: pointer;
  font-family: var(--font-body); font-size: .78rem; font-weight: 600;
  color: var(--muted); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md);
  transition: all .16s var(--ease-soft);
}
.fee-mode:hover { border-color: var(--brand-200); color: var(--text); }
.fee-mode.is-on {
  border-color: var(--brand); color: var(--brand-text);
  background: var(--brand-tint);
  box-shadow: inset 0 0 0 1px var(--brand);
}
.fee-mode svg { flex: none; }

.fee-waive {
  display: flex; align-items: flex-start; gap: .5rem;
  margin-top: .8rem; padding: .6rem .7rem;
  font-size: .8rem; color: var(--text); cursor: pointer;
  background: var(--surface-2); border-radius: var(--r-md);
}
.fee-waive input { margin-top: .2rem; flex: none; }
.fee-waive small { display: block; color: var(--faint); font-size: .72rem; }

@media (max-width: 480px) {
  .fee-modes { grid-template-columns: 1fr; }
  .fee-mode { flex-direction: row; justify-content: center; gap: .5rem; }
}

/* -----------------------------------------------------------------------------
   PATIENT INTAKE
   -------------------------------------------------------------------------- */
.intake {
  display: grid; grid-template-columns: 1fr 1fr; gap: .1rem .7rem;
  margin-top: .35rem; padding-top: .75rem;
  border-top: 1px dashed var(--line);
}
.intake-field.is-wide { grid-column: 1 / -1; }
.intake .field { margin-bottom: .55rem; }
.intake label { font-size: .76rem; }
.intake .input, .intake .select { font-size: .84rem; }
.intake textarea.input { resize: vertical; min-height: 2.4rem; line-height: 1.45; }
.intake-other { margin-top: .35rem; }

@media (max-width: 560px) { .intake { grid-template-columns: 1fr; } }

/* Read-only, for the profile and the doctor's screen */
.intake-summary {
  display: grid; gap: .1rem;
  margin-top: .7rem; padding: .7rem .8rem;
  background: var(--surface-2); border-radius: var(--r-md);
}
.intake-row {
  display: grid; grid-template-columns: minmax(8rem, 40%) 1fr;
  gap: .7rem; padding: .35rem 0; font-size: .82rem;
  border-bottom: 1px solid var(--line-soft);
}
.intake-row:last-child { border-bottom: 0; }
.intake-row span { color: var(--muted); }
.intake-row strong { font-weight: 600; overflow-wrap: anywhere; }

/* -----------------------------------------------------------------------------
   SETTINGS
   -------------------------------------------------------------------------- */
.set-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
}
.set-row strong { display: block; font-family: var(--font-display); font-size: .95rem; }
.set-row small { color: var(--muted); font-size: .78rem; }
.set-money {
  display: flex; align-items: center; gap: .2rem;
  padding: .3rem .6rem;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.set-money > span { color: var(--muted); font-weight: 600; }
.set-money .input {
  width: 6ch; border: 0; background: transparent; padding: .2rem 0;
  font-family: var(--font-display); font-weight: 700; font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}
.set-money.sm .input { width: 5ch; font-size: .95rem; }
.set-money .input:focus { outline: none; }

.set-sub { margin-top: 1.1rem; padding-top: .9rem; border-top: 1px dashed var(--line); }
.set-sub h4 { margin: 0 0 .15rem; }
.set-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: .5rem; margin-top: .6rem;
}
.set-mini {
  display: flex; align-items: center; justify-content: space-between;
  gap: .6rem; padding: .4rem .55rem;
  background: var(--surface-2); border-radius: var(--r-md);
  font-size: .84rem;
}
.set-mini > span:first-child { color: var(--text); }

.set-locked {
  display: flex; align-items: flex-start; gap: .45rem;
  margin: .9rem 0 0; padding: .6rem .7rem;
  font-size: .8rem; line-height: 1.5; color: var(--muted);
  background: color-mix(in srgb, var(--brand) 7%, transparent);
  border: 1px dashed color-mix(in srgb, var(--brand) 30%, transparent);
  border-radius: var(--r-md);
}
.set-locked svg { flex: none; margin-top: .12rem; color: var(--brand); }
.set-locked strong { color: var(--brand-text); }

.set-upi { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-top: .8rem; }
@media (max-width: 560px) { .set-upi { grid-template-columns: 1fr; } }
.set-preview {
  display: flex; align-items: center; gap: .85rem;
  margin-top: .6rem; padding: .7rem;
  border: 1px solid var(--line); border-radius: var(--r-md);
}
.set-preview strong { display: block; font-family: var(--font-display); font-size: .88rem; }
.set-preview small { color: var(--muted); font-size: .78rem; }

.set-fields { display: grid; gap: .4rem; }
.set-field {
  display: flex; align-items: center; justify-content: space-between; gap: .7rem;
  padding: .55rem .7rem;
  background: var(--surface-2); border-radius: var(--r-md);
}
.set-field strong { display: block; font-size: .86rem; }
.set-field small { color: var(--faint); font-size: .74rem; text-transform: capitalize; }
.set-new {
  display: grid; grid-template-columns: 2fr 1fr auto; gap: .5rem; margin-top: .6rem;
}
.set-new .input[hidden] { display: none; }
@media (max-width: 620px) { .set-new { grid-template-columns: 1fr; } }

/* The fee dialog is wider than an ordinary modal because the payment code has
   to be big enough to scan across a counter without the desk scrolling. */
.modal.modal-fee { width: min(720px, 100%); }
.fee-split { display: grid; gap: .9rem; }
.fee-left { display: flex; flex-direction: column; justify-content: center; }
.fee-left .fee-amount { margin: 0; }

@media (min-width: 620px) {
  .fee-split { grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; }
  .fee-pay { margin-bottom: 0; }
}
