/* =========================================================================
   The patient's own page.

   Same palette and the same one-column shape as the questionnaire and the
   signing page — a patient who has already seen one of those should recognise
   this. It is deliberately not the clinical interface: no rail, no tabs, no
   density. Somebody opening this is looking for one fact — when am I in, what
   do I owe, where is that letter — and should find it without reading a
   screen.
   ========================================================================= */

/* Rufina Bold, the headline face of the practice website (see form.css). */
@font-face { font-family: "Rufina"; font-weight: 700; font-style: normal; font-display: swap;
  src: url(/fonts/rufina-700-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Rufina"; font-weight: 700; font-style: normal; font-display: swap;
  src: url(/fonts/rufina-700-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1EFF; }

:root {
  color-scheme: light;
  /* the practice website's own palette — the same as the questionnaire and
     the booking page, so the patient never feels they have left it (1.12.184) */
  --bg:          #e6ddca;
  --surface:     #fdf9ee;
  --surface-2:   #f9f1de;
  --surface-3:   #efe6d0;
  --ink-4:       #98a3aa;
  --line:        #d8cdb4;
  --line-strong: #c4b695;
  --ink:         #30383d;
  --ink-2:       #4b5a63;
  --ink-3:       #6b7a84;
  --accent:      #576a79;
  --accent-ink:  #ffffff;
  --accent-soft: #e1e6ea;
  --accent-line: #b6c3cc;
  --ok:      #15803d;  --ok-soft:     #e6f4ea;
  --warn:    #b45309;  --warn-soft:   #fdf1e0;
  --danger:  #b42318;  --danger-soft: #fdeceb;
  --radius: 15px;
  --radius-lg: 20px;
  --shadow-1: 0 1px 2px rgba(48,56,61,.05), 0 1px 3px rgba(48,56,61,.04);
  --shadow-2: 0 2px 4px rgba(48,56,61,.05), 0 8px 24px rgba(48,56,61,.07);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Rufina", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.55;
  -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased;
}

.loading { display: grid; place-items: center; min-height: 70vh; }
.spin {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid var(--line); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* The column asks its own width, not the window's.
   This same page is rendered inside a telephone-shaped panel in the demo, on a
   desktop screen — and a viewport media query there measures the desktop and
   lays the page out as though there were room. Asking the container instead
   gives one answer that is right on a real telephone and right in the panel. */
.wrap {
  max-width: 720px; margin: 0 auto; padding: 22px 18px 60px;
  container-type: inline-size; container-name: page;
}

/* ---- signing in ------------------------------------------------------- */
.gate { max-width: 460px; margin: 8vh auto 0; padding: 0 18px; }
.gate h1 { font-size: 1.5rem; margin: 0 0 6px; letter-spacing: -.02em; }
.gate p { color: var(--ink-2); margin: 0 0 18px; }
.gate .card { padding: 22px; }

/* ---- the page --------------------------------------------------------- */
.p-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding-bottom: 14px; margin-bottom: 18px; border-bottom: 1px solid var(--line);
}
.p-head h1 { font-size: 1.35rem; margin: 0; letter-spacing: -.02em; width: 100%; }
@container page (min-width: 520px) { .p-head h1 { width: auto; } }
.p-head .who { color: var(--ink-3); font-size: .9rem; }
.p-head .spacer { flex: 1; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-1); padding: 18px;
  margin-bottom: 14px;
}
.card h2 {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--ink-3); margin: 0 0 12px; font-weight: 650;
}
.muted { color: var(--ink-3); }
.small { font-size: .86rem; }
.tiny  { font-size: .78rem; }
.tnum  { font-variant-numeric: tabular-nums; }
.right { text-align: right; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 16px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: .92rem;
  font-weight: 550; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.wide { width: 100%; }
.btn.sm { padding: 7px 12px; font-size: .84rem; }
.btn:disabled { opacity: .5; cursor: default; }

input[type=text], input[type=email], input[type=tel] {
  width: 100%; padding: 12px 13px; border: 1px solid var(--line-strong);
  border-radius: 10px; background: var(--surface); color: var(--ink);
  font: inherit; font-size: 16px;   /* 16px or iOS zooms the page on focus */
}
label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; font-size: .84rem; color: var(--ink-2); margin-bottom: 5px; }

/* ---- rows ------------------------------------------------------------- */
.row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
/* On a telephone the two buttons drop under the row rather than squeezing the
   title into a three-line column beside them. Most people open this on a
   phone, and an appointment whose name you cannot read is not an appointment
   you can confirm with any confidence. */
.row .actions { display: flex; gap: 8px; margin-left: auto; }
@container page (max-width: 460px) {
  .row { align-items: flex-start; }
  .row .actions { width: 100%; margin-left: 0; padding-left: 96px; }
  .row .actions .btn { flex: 1; }
}
.row:last-child { border-bottom: 0; padding-bottom: 0; }
.row:first-of-type { padding-top: 0; }
.row .body { flex: 1; min-width: 0; }
.row .body b { display: block; font-weight: 600; }
.row .body span { display: block; color: var(--ink-3); font-size: .84rem; }
.row .when {
  flex: 0 0 84px; text-align: center; font-variant-numeric: tabular-nums;
  border-right: 1px solid var(--line); padding-right: 12px;
}
.row .when b { display: block; font-size: 1.05rem; }
.row .when span { display: block; font-size: .74rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }

.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: .74rem; font-weight: 600; color: var(--ink-2);
}
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.owed {
  background: var(--warn-soft); border: 1px solid transparent;
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px;
}
.owed h2 { color: var(--warn); }
.owed .total { font-size: 1.5rem; font-weight: 650; letter-spacing: -.02em; }

.note { background: var(--accent-soft); border-radius: var(--radius); padding: 14px 16px;
  color: var(--accent); font-size: .88rem; margin-bottom: 14px; }
.err { background: var(--danger-soft); color: var(--danger); border-radius: var(--radius);
  padding: 12px 14px; font-size: .9rem; margin-bottom: 12px; }

/* ---- tabs ------------------------------------------------------------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 16px;
  border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
/* Four headings do not fit across a telephone, so the strip scrolls — and a
   strip that scrolls with no sign of it is a tab nobody ever finds. The fade
   is on only while there is something still to the right of it, and goes as
   soon as the last one is reached. */
.tabs.more {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
          mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
}
.tabs button {
  border: 0; background: none; font: inherit; font-size: .92rem; font-weight: 550;
  color: var(--ink-3); padding: 9px 12px; cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
@container page (max-width: 460px) {
  .tabs button { font-size: .86rem; padding: 9px 9px; }
}
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }

/* ---- photographs ------------------------------------------------------ */
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.shot { position: relative; border-radius: 10px; overflow: hidden; background: var(--surface-2);
  aspect-ratio: 3 / 4; border: 1px solid var(--line); }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot .cap { position: absolute; inset: auto 0 0 0; padding: 5px 7px; font-size: .7rem;
  background: linear-gradient(transparent, rgba(0,0,0,.65)); color: #fff; }
.shot .sim { position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,.6); color: #fff;
  font-size: .6rem; letter-spacing: .08em; padding: 2px 6px; border-radius: 4px; }

/* ---- a document, read in place ---------------------------------------- */
.sheet {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 24px; font-size: 15px; line-height: 1.65; overflow-wrap: break-word;
}
.sheet table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: .9em; }
.sheet th, .sheet td { border: 1px solid var(--line); padding: 6px 9px; text-align: left; }
.sheet .doc-head { display: flex; justify-content: space-between; gap: 18px;
  border-bottom: 2px solid var(--ink); padding-bottom: 12px; margin-bottom: 16px; }
.sheet .doc-head .clinic b { display: block; font-size: 1.05rem; }
.sheet .doc-head .clinic span, .sheet .doc-head .meta { font-size: .8rem; color: var(--ink-3); display: block; }
.sheet .doc-parties { display: flex; justify-content: space-between; gap: 18px; margin-bottom: 16px; font-size: .88rem; }
.sheet .doc-kv { margin: 8px 0 14px; font-size: .88rem; }
.sheet .doc-kv > div { display: flex; gap: 12px; padding: 3px 0; align-items: baseline; }
.sheet .doc-kv > div > span:first-child { flex: 0 0 130px; color: var(--ink-3); }
.sheet .doc-kv > div > span:last-child { flex: 1; min-width: 0; }
.sheet .doc-foot { margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: .76rem; color: var(--ink-3); }
.sheet .doc-sign { margin-top: 24px; }
.sheet .doc-sign-marks { display: flex; align-items: flex-end; justify-content: flex-start; gap: 22px; }
.sheet .ink-sig { width: 128px; height: auto; }
.sheet .ink-stamp { width: 170px; height: auto; }
.sheet .ink-rule { flex: 0 0 200px; border-bottom: 1px solid var(--ink-3); height: 30px; }
.sheet .doc-sign-who { font-size: .76rem; color: var(--ink-3); margin-top: 4px; }

/* ---- the two spaces at the foot of a consent form ----------------------
 *
 * One for the patient and one for the surgeon, side by side where there is
 * room and stacked where there is not. Each is a mark over a ruled line with
 * a name and a date under it — which is what the typed underscores they
 * replaced were always trying to be.
 *
 * The rule is drawn under the marks rather than instead of them, so a signed
 * space and an unsigned one are the same shape and a form printed for signing
 * by hand still has somewhere to sign.
 */
.doc-sig-slot {
  display: inline-block; vertical-align: top;
  width: 46%; min-width: 220px; margin: 26px 3% 0 0;
  break-inside: avoid; page-break-inside: avoid;
}
.doc-sig-slot .doc-sign-marks {
  justify-content: flex-start; gap: 14px; min-height: 54px;
  border-bottom: 1px solid var(--ink-3, #7b827f); padding-bottom: 2px;
}
.doc-sig-slot .ink-sig { width: auto; max-width: 160px; max-height: 54px; }
.doc-sig-slot .ink-stamp { width: auto; max-width: 140px; max-height: 54px; }
.doc-sig-rule { display: block; width: 100%; height: 44px; }
.doc-sig-typed {
  font-family: "Snell Roundhand", "Apple Chancery", "Segoe Script", "Bradley Hand", cursive;
  font-size: 1.5rem; line-height: 1; color: #152238; align-self: flex-end; padding-bottom: 4px;
}
.doc-sig-when { font-weight: 600; }
.doc-sig-how { opacity: .8; }
@media (max-width: 560px) {
  .doc-sig-slot { width: 100%; margin-right: 0; }
  .doc-sig-slot .doc-sign-marks { flex-direction: row; align-items: flex-end; gap: 14px; }
}

.sheet img { max-width: 100%; }

.foot { margin-top: 30px; text-align: center; color: var(--ink-3); font-size: .8rem; }
.foot a { color: var(--ink-3); }
/* The practice's logo at the head of the page, when one has been set. */
.masthead-logo { display: block; height: auto; width: auto; max-height: 44px; max-width: 180px; margin-right: 12px; }

/* Pressing Print uses a clean frame — see client/js/printsheet.js — so the
   paper carries the document and nothing else. This is for the browser's own
   Ctrl+P on the page as it stands. */
@media print {
  @page { size: A4; margin: 14mm 15mm; }
  .p-head, .btn, .p-nav, .p-foot { display: none !important; }
  body, .wrap, .sheet { background: #fff; margin: 0; padding: 0; box-shadow: none;
    border: 0; max-width: none; }
}

/* ---- 1.12.184: headings in the website's face; the to-do card --------- */
.gate h1, .p-head h1 { font-family: var(--serif); font-weight: 700; letter-spacing: 0; font-size: 1.6rem; color: var(--ink); }
.card.todo.has { border: 1.5px solid var(--accent); background: var(--surface); }
.card.todo h2 { display: flex; align-items: center; gap: 8px; }
.card.todo.has h2 { color: var(--accent); }
.card.todo .count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-size: .72rem; letter-spacing: 0; }
.card.todo #todo-appts:not(:empty) { padding-top: 12px; }
.card.todo .row:first-of-type { padding-top: 12px; }
.card.todo h2 + .row { padding-top: 0; }
.todo-pay { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.todo-pay .total { font-size: 1.15rem; }
.todo-pay #owed-list .row:first-of-type { padding-top: 12px; }

/* Their payments (1.12.186). */
.row.pay-total { background: var(--surface-2); margin: 0 -18px 4px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.row.pay-total + .row { padding-top: 12px; }
.tnum.refund { color: var(--warn); }
