/* White Oaks Chiropractic patient portal. Colours and fonts match whiteoakschiropractic.com
   and the approved mockup. Fonts are self-hosted: no calls to Google or anyone else. */

@font-face { font-family: "Oswald"; font-weight: 400; font-display: swap; src: url(fonts/oswald-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Oswald"; font-weight: 500; font-display: swap; src: url(fonts/oswald-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Libre Baskerville"; font-weight: 400; font-display: swap; src: url(fonts/libre-baskerville-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Libre Baskerville"; font-weight: 700; font-display: swap; src: url(fonts/libre-baskerville-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Roboto"; font-weight: 400; font-display: swap; src: url(fonts/roboto-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Roboto"; font-weight: 500; font-display: swap; src: url(fonts/roboto-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Roboto"; font-weight: 700; font-display: swap; src: url(fonts/roboto-latin-700-normal.woff2) format("woff2"); }

:root {
  --charcoal: #2F2E2E; --teal: #285A5B; --teal-dark: #1E4647; --teal-soft: #E4EDEC; --sage: #A8B8AE;
  --mist: #EEF2F0; --paper: #FFFDFB; --ink: #2A2A2A; --quiet: #5E6663; --rule: #E3E8E5;
  --film: #141819; --film-bar: #283032; --film-ink: #E6ECE9; --film-quiet: #9AA7A2;
  --amber: #F2C66D; --warn-bg: #FFF4DA; --warn-ink: #6B4A00; --danger: #9B2C2C; --danger-bg: #FBEAEA; --ok-bg: #E4EDEC;
  --serif: "Libre Baskerville", Georgia, "Times New Roman", serif;
  --display: "Oswald", "Arial Narrow", Arial, sans-serif;
  --sans: "Roboto", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); line-height: 1.5; font-size: 16px; display: flex; flex-direction: column; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--sage); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2 { font-family: var(--serif); font-weight: 700; color: var(--teal); line-height: 1.25; }
h3 { font-family: var(--display); font-weight: 500; color: var(--teal); letter-spacing: .02em; font-size: 1.15rem; margin: 0 0 12px; }
a { color: var(--teal); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header ---------- */
.p-head { background: var(--charcoal); color: #fff; display: flex; align-items: center; gap: 28px; padding: 8px 28px; flex-wrap: wrap; }
.p-head .logo { height: 60px; width: auto; display: block; }
.p-nav { display: flex; gap: 22px; font-size: .95rem; flex: 1; flex-wrap: wrap; }
.p-nav a { color: #fff; text-decoration: none; opacity: .88; padding: 6px 0; border-bottom: 2px solid transparent; }
.p-nav a:hover { opacity: 1; }
.p-nav a[aria-current="page"] { color: var(--sage); opacity: 1; border-bottom-color: var(--sage); }
.p-user { display: flex; align-items: center; gap: 10px; font-size: .9rem; color: #fff; }
.p-user button { background: transparent; border: 1px solid #6B7370; color: #fff; border-radius: 999px; padding: 4px 12px; font-size: .82rem; }
.p-user button:hover { border-color: var(--sage); color: var(--sage); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--sage); color: var(--charcoal); display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; }
.badge { display: inline-block; background: var(--sage); color: var(--charcoal); border-radius: 999px; font-size: .72rem; font-weight: 700; padding: 0 7px; margin-left: 4px; }

.demo-banner { background: var(--warn-bg); color: var(--warn-ink); font-size: .85rem; padding: 6px 28px; text-align: center; border-bottom: 1px solid #EBD9A8; }

main { flex: 1; display: flex; flex-direction: column; }
.p-foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; background: var(--mist); padding: 10px 28px; font-size: .8rem; color: var(--quiet); border-top: 1px solid var(--rule); }

/* ---------- three-column scans layout (matches mockup) ---------- */
.p-body { display: grid; grid-template-columns: 240px minmax(0, 1fr) 320px; flex: 1; min-height: 560px; }
.p-side { border-right: 1px solid var(--rule); padding: 22px 16px; background: var(--paper); }
.scan-btn { display: block; width: 100%; text-align: left; border: 1px solid transparent; background: none; border-radius: 8px; padding: 10px 12px; margin-bottom: 6px; color: var(--ink); }
.scan-btn strong { display: block; font-weight: 500; font-size: .93rem; }
.scan-btn span { font-size: .8rem; color: var(--quiet); }
.scan-btn:hover { background: var(--mist); }
.scan-btn[aria-pressed="true"] { background: var(--teal-soft); border-color: #C3D6D4; }
.side-sep { height: 1px; background: var(--rule); margin: 18px 0; }
.visit { font-size: .86rem; color: var(--quiet); margin: 0 0 6px; }
.visit b { color: var(--ink); font-weight: 500; }
.empty { color: var(--quiet); font-size: .9rem; }

.viewer { background: var(--film); color: var(--film-ink); display: flex; flex-direction: column; min-width: 0; }
.v-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 18px; font-size: .88rem; border-bottom: 1px solid var(--film-bar); }
.v-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.v-tools button { background: #232A2C; border: 1px solid #39434A; color: var(--film-ink); border-radius: 6px; padding: 5px 10px; font-size: .82rem; }
.v-tools button:hover { border-color: var(--sage); }
.v-tools button[aria-pressed="true"] { background: var(--teal); border-color: var(--teal); color: #fff; }
.v-stage { flex: 1; overflow: auto; display: flex; padding: 14px; min-height: 380px; }
.v-film { position: relative; margin: auto; width: 100%; max-width: 520px; flex: none; }
.v-film img { display: block; width: 100%; height: auto; user-select: none; -webkit-user-drag: none; }
.v-film.placing { cursor: crosshair; }
.v-msg { margin: auto; color: var(--film-quiet); text-align: center; padding: 20px; }
.v-foot { color: var(--film-quiet); font-size: .78rem; padding: 10px 18px; border-top: 1px solid var(--film-bar); }
.mk { position: absolute; transform: translate(-50%, -50%); width: 34px; height: 34px; border-radius: 50%; background: var(--sage); color: var(--charcoal);
  font-weight: 700; font-size: .95rem; display: grid; place-items: center; border: 3px solid #FFFDFB; padding: 0; box-shadow: 0 1px 6px rgba(0,0,0,.6); }
.mk.on { background: var(--amber); transform: translate(-50%, -50%) scale(1.15); }
.mk:hover { background: #C4D2C9; }
.v-film.no-marks .mk { display: none; }

.notes { padding: 22px 20px; border-left: 1px solid var(--rule); background: var(--paper); min-width: 0; }
.note-by { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.note-by .avatar { background: var(--teal); color: #fff; }
.note-by div { font-size: .86rem; color: var(--quiet); line-height: 1.35; }
.note-by b { color: var(--ink); font-weight: 500; display: block; }
.notes p { font-size: .93rem; margin: 0 0 12px; }
.marks { list-style: none; margin: 0 0 16px; padding: 0; }
.marks li { display: flex; gap: 10px; font-size: .9rem; margin-bottom: 8px; padding: 6px; border-radius: 8px; }
.marks li.on { background: var(--teal-soft); }
.pin { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--sage); color: var(--charcoal); font-weight: 700; font-size: .78rem; display: grid; place-items: center; }
.progress { background: var(--mist); border-radius: 8px; padding: 12px; margin-bottom: 16px; font-size: .88rem; }
.bar { height: 8px; border-radius: 4px; background: #D6DEDA; margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--teal); }
.actions { display: flex; flex-direction: column; gap: 8px; }

/* ---------- buttons and forms ---------- */
.btn { display: inline-block; text-align: center; text-decoration: none; border-radius: 999px; padding: 9px 18px; font-weight: 500; font-size: .9rem; border: 1px solid var(--teal); background: transparent; color: var(--teal); }
.btn:hover { background: var(--teal-soft); }
.btn.solid { background: var(--teal); color: #fff; }
.btn.solid:hover { background: var(--teal-dark); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger-bg); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.small { padding: 5px 12px; font-size: .82rem; }
label { display: block; font-weight: 500; font-size: .9rem; margin: 0 0 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], select, textarea {
  width: 100%; border: 1px solid #C9D1CD; border-radius: 8px; padding: 9px 12px; background: #fff; font-size: .95rem; }
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); outline: 2px solid var(--teal-soft); }
.field { margin-bottom: 14px; }
.hint { font-size: .82rem; color: var(--quiet); margin: 4px 0 0; }
.alert { border-radius: 8px; padding: 10px 14px; font-size: .9rem; margin: 0 0 14px; }
.alert.error { background: var(--danger-bg); color: var(--danger); }
.alert.ok { background: var(--ok-bg); color: var(--teal-dark); }
.alert.warn { background: var(--warn-bg); color: var(--warn-ink); }
.urgent { background: var(--mist); border-left: 4px solid var(--teal); border-radius: 6px; padding: 10px 14px; font-size: .9rem; margin: 0 0 16px; }

/* ---------- simple pages (password, sign in) ---------- */
.center-page { flex: 1; display: grid; place-items: center; padding: 32px 16px; background: var(--mist); }
.card-box { background: var(--paper); border: 1px solid var(--rule); border-radius: 14px; padding: 28px; width: 100%; max-width: 420px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.card-box h1 { font-size: 1.35rem; margin: 0 0 6px; }
.card-box .sub { color: var(--quiet); font-size: .92rem; margin: 0 0 20px; }
.card-box .btn { width: 100%; }
.simple-head { justify-content: center; }
.demo-accounts { margin-top: 22px; border-top: 1px solid var(--rule); padding-top: 16px; }
.demo-accounts p { font-size: .85rem; color: var(--quiet); margin: 0 0 8px; }
.demo-accounts button { display: flex; justify-content: space-between; width: 100%; text-align: left; background: var(--mist); border: 1px solid transparent; border-radius: 8px; padding: 8px 12px; margin-bottom: 6px; font-size: .88rem; }
.demo-accounts button:hover { border-color: var(--sage); }
.demo-accounts small { color: var(--quiet); text-transform: capitalize; }
.code-shown { font-family: var(--display); font-size: 1.6rem; letter-spacing: .2em; color: var(--teal); }

/* ---------- content pages (visits, care plan, messages, clinic lists) ---------- */
.page { width: 100%; max-width: 980px; margin: 0 auto; padding: 28px 24px 48px; }
.page h2 { font-size: 1.4rem; margin: 0 0 6px; }
.page .lede { color: var(--quiet); margin: 0 0 20px; }
.panel { background: #fff; border: 1px solid var(--rule); border-radius: 12px; padding: 18px 20px; margin-bottom: 16px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.list li:last-child { border-bottom: 0; }
.tag { display: inline-block; background: var(--teal-soft); color: var(--teal); border-radius: 999px; padding: 2px 10px; font-size: .75rem; font-weight: 500; }
.tag.draft { background: var(--warn-bg); color: var(--warn-ink); }
.tag.muted { background: var(--mist); color: var(--quiet); }
.big-progress { font-family: var(--display); font-size: 2.2rem; color: var(--teal); line-height: 1; }
.big-progress small { font-family: var(--sans); font-size: 1rem; color: var(--quiet); }
.big-progress + .bar { height: 12px; border-radius: 6px; }

.thread { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.msg { max-width: 78%; border-radius: 12px; padding: 10px 14px; font-size: .93rem; background: var(--mist); }
.msg.mine { align-self: flex-end; background: var(--teal); color: #fff; }
.msg .who { display: block; font-size: .76rem; opacity: .8; margin-bottom: 2px; }
.msg p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- clinic ---------- */
.clinic-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr) 340px; flex: 1; min-height: 560px; }
.clinic-grid.two { grid-template-columns: 260px minmax(0, 1fr); }
.patient-btn { display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: left; background: none; border: 1px solid transparent; border-radius: 8px; padding: 9px 12px; margin-bottom: 4px; }
.patient-btn:hover { background: var(--mist); }
.patient-btn[aria-pressed="true"] { background: var(--teal-soft); border-color: #C3D6D4; }
.patient-btn small { color: var(--quiet); display: block; font-size: .78rem; }
.mk-edit { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 10px; }
.mk-edit textarea { min-height: 60px; font-size: .88rem; }
.mk-edit .tools { display: flex; flex-direction: column; gap: 4px; }
.status-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; font-size: .88rem; color: var(--quiet); }
table.audit { width: 100%; border-collapse: collapse; font-size: .84rem; background: #fff; }
table.audit th, table.audit td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.audit th { font-family: var(--display); font-weight: 500; color: var(--teal); letter-spacing: .02em; background: var(--mist); position: sticky; top: 0; }
.table-wrap { overflow: auto; max-height: 70vh; border: 1px solid var(--rule); border-radius: 10px; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; align-items: end; margin-bottom: 16px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: .9rem; }
.kv dt { color: var(--quiet); }
.kv dd { margin: 0; }
dialog { border: 0; border-radius: 14px; padding: 24px; max-width: 460px; width: calc(100% - 32px); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(20,24,25,.5); }
dialog h2 { font-size: 1.15rem; margin: 0 0 10px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.dialog-actions .btn { width: auto; }

/* ---------- phones and tablets ---------- */
@media (max-width: 1100px) {
  .p-body { grid-template-columns: 220px minmax(0, 1fr); }
  .p-body .notes { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--rule); }
  .clinic-grid { grid-template-columns: 230px minmax(0, 1fr); }
  .clinic-grid .notes { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--rule); }
}
@media (max-width: 720px) {
  .p-head { padding: 8px 16px; gap: 10px 16px; }
  .p-head .logo { height: 48px; }
  .p-nav { order: 3; flex-basis: 100%; gap: 16px; overflow-x: auto; flex-wrap: nowrap; font-size: .9rem; }
  .p-nav a { white-space: nowrap; }
  .p-user { margin-left: auto; }
  .p-user .name { display: none; }
  .demo-banner, .p-foot { padding-left: 16px; padding-right: 16px; }
  .p-body, .clinic-grid, .clinic-grid.two { grid-template-columns: 1fr; }
  .p-side { border-right: 0; border-bottom: 1px solid var(--rule); padding: 16px; }
  .p-side .scan-list { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
  .p-side .scan-btn { flex: none; width: auto; max-width: 240px; margin: 0; border-color: var(--rule); }
  .p-side .visits-block { display: none; }
  .v-stage { min-height: 300px; padding: 10px; }
  .notes { padding: 18px 16px; }
  .page { padding: 20px 16px 40px; }
  .msg { max-width: 92%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
