/* Test patient portal (/testportal). Site tokens only; builds on booking.css. */
.tp-card { display: flex; flex-direction: column; gap: var(--space-3); }
.tp-test {
  align-self: flex-start; margin: 0;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--color-text-muted); border: 1px solid var(--color-border);
  border-radius: var(--radius-full, 999px); padding: 2px var(--space-3);
}
.tp-root { display: flex; flex-direction: column; gap: var(--space-5); }
.tp-muted { margin: 0; font-size: var(--text-sm); color: var(--color-text-muted); line-height: 1.6; }
.tp-muted a { color: var(--color-text); font-weight: 600; }
.tp-sec { display: flex; flex-direction: column; gap: var(--space-2); }
.tp-sec__title {
  margin: 0; font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 500;
  letter-spacing: .08em; text-transform: uppercase; color: var(--color-text-muted);
}
.tp-docs, .tp-visits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.tp-doc {
  width: 100%; font: inherit; color: var(--color-text); cursor: pointer; text-align: left;
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-3) var(--space-4); min-height: 56px;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  transition: border-color var(--transition-interactive);
}
@media (hover: hover) { .tp-doc:hover { border-color: var(--color-text); } }
.tp-doc:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.tp-doc[disabled] { cursor: progress; opacity: .75; }
.tp-doc__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tp-doc__title { font-weight: 600; }
.tp-doc__date, .tp-doc__status { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-text-muted); }
.tp-doc__status { white-space: nowrap; }
.tp-doc__status::after { content: none; }
.tp-doc:not([disabled]) .tp-doc__status:empty::after { content: 'Open \2192'; }
.tp-doc__open { color: var(--color-text); font-weight: 600; text-decoration: underline; }
.tp-visit {
  display: flex; flex-direction: column; gap: 2px; padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-divider); border-radius: var(--radius-lg);
}
.tp-visit__when { font-weight: 600; font-variant-numeric: tabular-nums; }
.tp-visit__where { font-size: var(--text-sm); color: var(--color-text-muted); }
.tp-info {
  margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr);
  gap: var(--space-2) var(--space-4); font-size: var(--text-sm);
}
.tp-info dt { color: var(--color-text-muted); }
.tp-info dd { margin: 0; color: var(--color-text); overflow-wrap: anywhere; }
@media (max-width: 420px) {
  .tp-info { grid-template-columns: 1fr; gap: 0; }
  .tp-info dd { margin-bottom: var(--space-2); }
}
.tp-actions { margin-top: 0; }

/* ---------- signed in: menu + panel ---------- */
/* Full page width; the help blocks sit in a row under the card. */
.tp-wrap.book-wrap { grid-template-columns: minmax(0, 1fr); }
.tp-wrap .book-card { max-width: none; }
.tp-wrap .book-aside {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-6);
  padding-top: var(--space-6); border-top: 1px solid var(--color-divider);
}
/* Before sign-in the card is just a short form: keep it readable. */
.tp-wrap .book-wrap:not(.is-signed-in) .tp-root, .tp-wrap:not(.is-signed-in) .tp-root { max-width: 520px; }
.tp-layout { display: grid; gap: var(--space-5); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) {
  .tp-layout { grid-template-columns: 260px minmax(0, 1fr); gap: var(--space-10, 2.5rem); align-items: start; }
  .tp-nav { position: sticky; top: var(--space-6); }
}
.tp-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.tp-nav__btn {
  width: 100%; font: inherit; font-size: var(--text-sm); font-weight: 600; color: var(--color-text-muted);
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-md); cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  padding: var(--space-2) var(--space-3); min-height: 44px; text-align: left;
  transition: background var(--transition-interactive), color var(--transition-interactive);
}
@media (hover: hover) { .tp-nav__btn:hover { color: var(--color-text); background: var(--color-surface-2); } }
.tp-nav__btn.is-on { color: var(--color-text); background: var(--color-surface-2); border-color: var(--color-border); }
.tp-nav__btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.tp-nav__count {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: var(--color-text-muted);
  min-width: 22px; text-align: center; padding: 0 6px; border-radius: 999px; border: 1px solid var(--color-border);
}
@media (max-width: 759px) {
  .tp-nav { margin-inline: calc(-1 * var(--space-2)); }
  .tp-nav ul { flex-direction: row; overflow-x: auto; scrollbar-width: none; padding: 2px var(--space-2); gap: var(--space-2); }
  .tp-nav ul::-webkit-scrollbar { display: none; }
  .tp-nav li { flex: 0 0 auto; }
  .tp-nav__btn { white-space: nowrap; border-color: var(--color-border); border-radius: 999px; min-height: 40px; padding-inline: var(--space-4); }
}
.tp-panel { display: flex; flex-direction: column; gap: var(--space-5); min-width: 0; scroll-margin-top: var(--space-6); }
.tp-panel:focus { outline: none; }
.tp-panel__title { margin: 0; font-size: var(--text-lg); font-weight: 700; letter-spacing: -0.01em; }

/* ---------- billing ---------- */
.tp-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.tp-kpi {
  display: flex; flex-direction: column; gap: var(--space-1);
  padding: var(--space-4); border: 1px solid var(--color-border); border-radius: var(--radius-lg);
}
.tp-kpi__label { font-size: var(--text-xs); font-weight: 700; color: var(--color-text-muted); }
.tp-kpi__val { font-family: var(--font-mono); font-size: var(--text-xl); font-weight: 500; font-variant-numeric: tabular-nums; }
.tp-tablewrap { overflow-x: auto; border: 1px solid var(--color-divider); border-radius: var(--radius-lg); }
.tp-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.tp-table th, .tp-table td { padding: var(--space-2) var(--space-3); text-align: right; white-space: nowrap; border-bottom: 1px solid var(--color-divider); }
.tp-table th:first-child, .tp-table td:first-child { text-align: left; }
.tp-table th { font-size: var(--text-xs); font-weight: 700; color: var(--color-text-muted); }
.tp-table td { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tp-table td:first-child { font-family: inherit; }
.tp-table tbody tr:last-child td { border-bottom: 0; }

/* ---------- sign-in by text + editing (2026-11-24) ---------- */
.tp-linkbtn {
  padding: 0; border: 0; background: none; font: inherit; color: var(--color-text-muted);
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.tp-linkbtn:hover { color: var(--color-text); }
.tp-ok {
  margin: 0; padding: var(--space-3) var(--space-4); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); background: var(--color-surface-2, #F3F1EC); font-size: var(--text-sm);
}
.tp-edit-actions { margin-top: var(--space-2); }
.tp-edit { gap: var(--space-4); }
.tp-row2, .tp-row3 { display: grid; gap: var(--space-3); grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .tp-row2 { grid-template-columns: 1fr 1fr; }
  .tp-row3 { grid-template-columns: 2fr 0.7fr 1fr; }
}
.tp-file { font-size: var(--text-sm); max-width: 100%; }
.tp-check { display: flex; gap: var(--space-2); align-items: flex-start; font-size: var(--text-sm); cursor: pointer; }
.tp-check input { margin-top: 3px; width: 18px; height: 18px; flex: none; }

/* ---------- install on the phone + notifications (2026-11-28) ---------- */
[data-tp-install]:empty { display: none; }
.tp-install {
  position: relative; display: flex; gap: var(--space-3);
  padding: var(--space-4) 44px var(--space-4) var(--space-4);
  border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-surface-2, #F3F1EC);
}
.tp-install__body { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.tp-install__title { margin: 0; font-weight: 700; }
.tp-install p, .tp-install li { text-wrap: pretty; }
.tp-install__steps { margin: 0; padding-left: 1.25rem; display: flex; flex-direction: column; gap: var(--space-1); font-size: var(--text-sm); line-height: 1.6; }
.tp-install__icon { display: inline-flex; vertical-align: -3px; color: #0A84FF; }
.tp-install .bk-actions { margin-top: var(--space-1); }
.tp-install__close {
  position: absolute; top: var(--space-2); right: var(--space-2); width: 36px; height: 36px;
  border: 0; border-radius: 999px; background: transparent; color: var(--color-text-muted);
  font: inherit; font-size: 22px; line-height: 1; cursor: pointer;
}
.tp-install__close:hover { color: var(--color-text); background: var(--color-surface); }
.tp-install__close:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.tp-notify { display: flex; flex-direction: column; gap: var(--space-4); }
.tp-notify__state { margin: 0; display: flex; align-items: center; gap: var(--space-2); font-weight: 600; }
.tp-notify__dot { width: 10px; height: 10px; border-radius: 999px; background: var(--color-text-muted); flex: none; }
.tp-notify__state[data-state="on"] .tp-notify__dot { background: #2F7D4F; }
.tp-notify__list { display: flex; flex-direction: column; gap: var(--space-2); }
.tp-notify__item {
  padding: var(--space-3) var(--space-4); border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  background: var(--color-surface);
}
.tp-notify__item > span { display: flex; flex-direction: column; gap: 2px; }
.tp-notify__label { font-weight: 600; color: var(--color-text); }
.tp-notify .bk-actions { margin-top: 0; }
/* Phones: hidden tabs to the right fade out instead of ending in a hard cut; the
   page keeps room under the floating Menu button (plus the Home Screen app's
   bottom safe area) so the last controls can always scroll clear of it. */
@media (max-width: 759px) {
  .tp-nav ul.is-more {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent);
            mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent);
  }
}
body.page-portal main { padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px)); }

/* ---------- OnPatient status line (2026-11-30) ---------- */
.tp-opstatus { display: flex; align-items: flex-start; gap: var(--space-2); margin: 0; font-size: var(--text-sm); }
.tp-opstatus__dot { flex: none; width: 10px; height: 10px; margin-top: 0.5em; border-radius: 50%; background: var(--color-text-muted); }
.tp-opstatus.is-on .tp-opstatus__dot { background: var(--color-success, #2E7D4F); }
.tp-opstatus.is-wait .tp-opstatus__dot { background: #C98A1B; }
.tp-opstatus.is-off .tp-opstatus__dot { background: transparent; border: 2px solid var(--color-text-muted); }

/* ---------- billing total row (2026-11-30) ---------- */
.tp-table tfoot th, .tp-table tfoot td { border-top: 2px solid var(--color-divider); border-bottom: 0; font-weight: 700; }
.tp-table tfoot th { text-align: left; font-size: var(--text-sm); color: var(--color-text); }
.tp-table tbody tr:last-child td { border-bottom: 0; }
