:root {
  --bg: #f5f7f8;
  --card: #ffffff;
  --ink: #17252c;
  --muted: #5f6f77;
  --line: #e1e7ea;
  --brand: #1f7f7b;       /* darker shade of the logo teal (#61C0BC), readable with white text */
  --brand-dark: #186562;
  --brand-soft: #e8f6f5;
  --logo-teal: #61c0bc;
  --danger: #b42318;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font); }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.nowrap { white-space: nowrap; }

/* Top bar */
.topbar { border-top: 4px solid var(--logo-teal); display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 12px 24px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.logo-img { display: block; height: 25px; width: auto; max-width: 60vw; }
.crm-tag { color: var(--muted); font-size: 12px; font-weight: 600; border-left: 1px solid var(--line); padding-left: 12px; }
.login-logo { display: block; height: 28px; width: auto; max-width: 100%; margin: 0 auto 24px; }
.login h1, .login > form > p { text-align: center; }
.sheet-logo { display: block; height: 24px; width: auto; }
.topbar nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.topbar nav a, .link { color: var(--muted); text-decoration: none; font: inherit; font-size: 14px; }
.topbar nav a:hover, .link:hover { color: var(--brand); }
.topbar nav form { margin: 0; }
.link { background: none; border: 0; cursor: pointer; padding: 0; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 24px; }
.wrap.narrow { max-width: 820px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 18px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: 600 14px var(--font); text-decoration: none; cursor: pointer; }
.btn:hover { border-color: #c5d0d5; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.lg { padding: 13px 28px; font-size: 16px; }
.btn.danger { color: var(--danger); border-color: #f3c7c2; }
.btn.danger:hover:not(:disabled) { background: #fef3f2; }
.bulk { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.danger-link { background: none; border: 0; color: var(--danger); font-weight: 500; padding: 4px 0; }

/* Form */
.hero { padding: 16px 0 8px; }
.hero h1 { font-size: 28px; }
.hero p { margin: 0 0 8px; }
.card h2 { display: flex; align-items: center; gap: 10px; font-size: 18px; margin-bottom: 18px; }
.step { width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.field, fieldset.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.field.wide { grid-column: 1 / -1; }
label, legend { font-weight: 600; font-size: 14px; }
legend { padding: 0; margin-bottom: 8px; }
.req { color: var(--danger); }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=datetime-local],
input[type=password], input[type=search], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid #cfd8dc; border-radius: 8px; background: #fff;
  font: 15px var(--font); color: var(--ink); }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(14, 107, 112, .25); border-color: var(--brand); }
.choices { display: grid; gap: 8px 16px; }
.choices.cols { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.choices.inline { display: flex; gap: 24px; }
.choice { display: flex; align-items: flex-start; gap: 8px; font-weight: 400; cursor: pointer; }
.choice input { margin-top: 4px; accent-color: var(--brand); width: 16px; height: 16px; flex: none; }
.other { display: flex; align-items: center; gap: 10px; font-weight: 400; margin-top: 10px; }
.other input { max-width: 340px; }
.has-err input, .has-err textarea { border-color: var(--danger); }
.err { color: var(--danger); font-size: 13px; margin: 2px 0 0; }
.alert { background: #fef3f2; border: 1px solid #fecdca; color: var(--danger); padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; }
.flash { background: var(--brand-soft); color: var(--brand-dark); padding: 10px 16px; border-radius: 8px; margin-bottom: 16px; }
.consent .choice { font-size: 14px; }
.actions { display: flex; justify-content: flex-end; margin-bottom: 40px; }
.center { text-align: center; }
.thanks { padding: 48px 24px; }
.thanks .check { width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 50%; background: var(--brand-soft);
  color: var(--brand); display: grid; place-items: center; font-size: 28px; font-weight: 700; }
.login { max-width: 400px; padding-top: 64px; }
.login .btn { width: 100%; margin-top: 16px; }

/* Accounts */
.topbar nav a.me { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 600; }
.role-tag { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 8px; letter-spacing: .02em; }
.r-admin { background: #ede9fe; color: #5b21b6; }
.r-staff { background: #e0f2fe; color: #075985; }
.off-tag { font-size: 11px; font-weight: 700; color: #b45309; }
tr.inactive td { opacity: .6; }
.owner-row { background: #fafbfc; }
.roles-help { display: grid; gap: 8px; padding: 14px 18px; font-size: 14px; }
.user-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start; }
.user-actions form.inline { margin: 0; }
form.inline { margin: 0; }
form.inline select { width: auto; padding: 6px 8px; font-size: 13px; }
details.reset summary { list-style: none; }
details.reset summary::-webkit-details-marker { display: none; }
details.reset form { display: flex; gap: 6px; margin-top: 6px; }
details.reset input { padding: 6px 8px; font-size: 13px; min-width: 210px; }
.add-user h2, .card > h2 { font-size: 17px; }
.clock { margin: 2px 0 0; }
.center { text-align: center; }

.admin-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.admin-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; overflow-wrap: anywhere; }
.section-title { font-size: 18px; margin: 26px 0 10px; }

/* Dashboard */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat span { color: var(--muted); font-size: 13px; }
.stat strong { display: block; font-size: 28px; font-variant-numeric: tabular-nums; }
.stat.accent { border-color: var(--brand); background: var(--brand-soft); }
.toolbar { margin-bottom: 12px; }
.search { display: flex; gap: 8px; max-width: 520px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.tab { padding: 7px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; }
.tab span { font-size: 12px; background: var(--line); border-radius: 10px; padding: 1px 7px; margin-left: 4px; }
.tab.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.tab.active span { background: var(--brand); color: #fff; }
.table-card { padding: 0; overflow: hidden; }
.table-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #fafbfc; }
th, td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcfc; }
td.cb, th.cb { width: 36px; padding-right: 0; }
td.cb input, th.cb input { accent-color: var(--brand); width: 16px; height: 16px; }
td.reason { max-width: 280px; color: var(--muted); }
.name { font-weight: 600; color: var(--ink); text-decoration: none; }
.name:hover { color: var(--brand); }
.new-tag { color: #15803d; font-size: 12px; font-weight: 700; letter-spacing: .02em; margin: 1px 0 2px; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); margin: 0; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; vertical-align: middle; white-space: nowrap; }
.s-new { background: #e0f2fe; color: #075985; }
.s-contacted { background: #fef3c7; color: #92400e; }
.s-booked { background: #ede9fe; color: #5b21b6; }
.s-seen { background: #dcfce7; color: #166534; }
.s-archived { background: #eef1f3; color: #5f6f77; }

/* Page heads, filters */
.topbar nav a.current { color: var(--ink); font-weight: 600; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { font-size: 24px; margin: 0; }
.toolbar.filters { display: flex; gap: 10px 14px; flex-wrap: wrap; align-items: center; }
.toolbar.filters .search { flex: 1 1 320px; }
.sort { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.sort select { width: auto; padding: 8px 10px; font-size: 14px; }
.filter-panel { flex: 1 1 100%; }
.filter-panel summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--brand); padding: 4px 0; }
.pill { background: var(--brand); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px 14px; align-items: end;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-top: 8px; }
.filter-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.filter-grid input, .filter-grid select { padding: 8px 10px; font-size: 14px; }
.filter-actions { display: flex; gap: 8px; }
.bulk select { width: auto; padding: 8px 10px; font-size: 14px; }
.wait { color: var(--muted); font-weight: 500; }
.wait.late, .late { color: #b45309; font-weight: 600; }
.doc-tag { color: #b45309; font-size: 12px; font-weight: 600; }

/* Dashboard */
a.stat { text-decoration: none; color: inherit; display: block; }
a.stat:hover { border-color: var(--brand); }
.stat .delta { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.tabs.period { margin: 0; }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.chart-card { margin: 0; padding: 18px 20px; min-width: 0; }
.chart-card.wide { grid-column: 1 / -1; }
.chart-card h2 { font-size: 16px; margin: 0 0 2px; }
.chart-card > p.muted { margin: 0 0 12px; }
.chart-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.col-chart { width: 100%; min-width: 620px; height: auto; display: block; }
.col-chart .grid { stroke: var(--line); stroke-width: 1; }
.col-chart .grid.base { stroke: #c5d0d5; }
.col-chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.col-chart .bar { fill: var(--brand); }
.col-chart .hit { fill: transparent; }
.col-chart .bar-g:hover .hit, .col-chart .bar-g:focus .hit { fill: rgba(31, 127, 123, .07); }
.col-chart .bar-g:hover .bar { fill: var(--brand-dark); }
.col-chart .bar-g:focus { outline: none; }
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hbars li { display: grid; grid-template-columns: minmax(90px, 38%) 1fr 34px; align-items: center; gap: 10px; font-size: 13px; }
.hb-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-label a { color: var(--ink); text-decoration: none; }
.hb-label a:hover { color: var(--brand); text-decoration: underline; }
.hb-track { display: block; width: 100%; height: 12px; }
.hb-bg { fill: #eef2f4; }
.hb-fill { fill: var(--brand); }
.hb-val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.mini-list { list-style: none; margin: 0 0 10px; padding: 0; }
.mini-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.mini-list li:last-child { border-bottom: 0; }
.mini-list a { color: var(--ink); font-weight: 600; text-decoration: none; }
.mini-list a:hover { color: var(--brand); }
.mini-list .today { color: var(--brand); font-weight: 700; }

/* Record */
.back { display: inline-block; margin-bottom: 14px; text-decoration: none; font-size: 14px; }
.rec-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.rec-head h1 { font-size: 26px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rec-head p { margin: 0 0 4px; }
.rec-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.side h3 { font-size: 15px; }
.side .field { margin-bottom: 12px; }
.side textarea { margin-bottom: 8px; }
.timeline { list-style: none; padding: 0; margin: 14px 0 0; }
.timeline li { border-left: 2px solid var(--line); padding: 0 0 12px 12px; }
.timeline p { margin: 0; white-space: pre-wrap; }
.timeline time { color: var(--muted); font-size: 12px; }

.rsec { margin-bottom: 22px; }
.rsec:last-child { margin-bottom: 0; }
.rsec h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--brand); border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 12px; }
dl { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; margin: 0; }
dl .wide { grid-column: 1 / -1; }
dt { font-size: 12px; color: var(--muted); font-weight: 600; }
dd { margin: 2px 0 0; white-space: pre-wrap; word-break: break-word; }
.ticks { list-style: none; padding: 0; margin: 4px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 3px 12px; white-space: normal; }
.ticks li { color: var(--muted); font-size: 14px; }
.ticks li::before { content: "☐ "; }
.ticks li.on { color: var(--ink); font-weight: 600; }
.ticks li.on::before { content: "☑ "; color: var(--brand); }

/* Signed documents on the form */
.hint { color: var(--muted); font-size: 12px; margin: 0; }
.doc h3 { font-size: 15px; margin: 18px 0 6px; }
.doc-title { font-weight: 600; color: var(--brand-dark); margin: -8px 0 10px; }
.doc p { margin: 0 0 10px; }
.doc-text { font-size: 14px; color: #33424a; }
.doc-text ul { margin: 0 0 10px; padding-left: 20px; }
.doc-text li { margin-bottom: 6px; }
.doc-boxes { display: grid; gap: 10px; margin: 12px 0 6px; }
.doc-boxes.cols3 { grid-template-columns: repeat(3, 1fr); }
.doc-boxes.cols2 { grid-template-columns: 2fr 1fr; }
.doc-boxes > div { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: #fafbfc; min-width: 0; }
.doc-boxes span:first-child { display: block; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.doc-boxes .mirror, .doc-boxes strong { display: block; min-height: 22px; font-weight: 600; text-transform: uppercase; overflow-wrap: anywhere; }
.doc-boxes.practitioner { margin-top: 16px; }
.sign-row { display: grid; grid-template-columns: 1fr 180px; gap: 16px; align-items: end; margin-top: 14px; }
.signed-date { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: #fafbfc; margin-bottom: 44px; }
.signed-date span { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.sig-field { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.sig-box { position: relative; height: 150px; border: 2px dashed #b9c6cc; border-radius: 10px; background: #fff; touch-action: none; }
.sig-field.signed .sig-box { border-style: solid; border-color: var(--brand); }
.sig-field.has-err .sig-box { border-color: var(--danger); }
.sig-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.sig-hint { position: absolute; inset: 0; display: grid; place-items: center; color: #9aa8ae; font-size: 14px; pointer-events: none; }
.sig-field.signed .sig-hint { display: none; }
.sig-x { position: absolute; left: 14px; bottom: 26px; color: #9aa8ae; pointer-events: none; }
.sig-box::after { content: ""; position: absolute; left: 34px; right: 16px; bottom: 30px; border-bottom: 1px solid #d5dde1; pointer-events: none; }
.sig-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.small-btn { padding: 6px 12px; font-size: 13px; }

/* Signatures on the staff record page */
.sig-views { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.sig-view dd { margin: 4px 0 0; }
.sig-view img { display: block; width: 100%; max-width: 280px; height: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* Print view */
.print-view { background: #e9edef; }
.print-bar { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 24px; background: var(--card); border-bottom: 1px solid var(--line); z-index: 1; }
.sheet { background: #fff; max-width: 8.5in; margin: 24px auto; padding: .6in; box-shadow: var(--shadow); font-size: 13px; }
.sheet-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid var(--logo-teal); padding-bottom: 10px; margin-bottom: 12px; }
.sheet-head p { margin: 6px 0 0; }
.sheet-head p { margin: 2px 0 0; font-weight: 600; }
.sheet-head .meta { display: flex; gap: 18px; text-align: right; }
.sheet-head .meta span { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.sheet .rsec { margin-bottom: 8px; }
.sheet .rsec h3 { break-after: avoid; }
.sheet .rsec h3 { font-size: 11px; padding-bottom: 3px; margin-bottom: 6px; }
.sheet dl { grid-template-columns: repeat(3, 1fr); gap: 5px 20px; }
.sheet dt { font-size: 10px; }
.sheet dd { margin: 0; font-size: 12.5px; line-height: 1.4; }
.sheet .ticks { gap: 0 12px; margin: 1px 0 0; }
.sheet .ticks li { font-size: 11px; }
.sheet:not(.msp):not(.ai) .ticks { grid-template-columns: repeat(5, 1fr); }
.sheet:not(.msp):not(.ai) dl { gap: 3px 20px; }
.pnote { margin: 0 0 4px; }
.pnote time { color: var(--muted); font-size: 11px; margin-right: 6px; }
.sign { display: grid; grid-template-columns: 2fr 1fr 1.5fr; gap: 24px; margin-top: 14px; break-inside: avoid; font-size: 11px; color: var(--muted); }
.sign span { display: block; border-bottom: 1px solid var(--ink); height: 24px; margin-bottom: 4px; }
.sign.two { grid-template-columns: 2fr 1fr; max-width: 70%; margin-left: auto; }

/* Printed MSP authorization (HLTH 2947 layout) */
.sheet.msp { font-family: Arial, Helvetica, sans-serif; font-size: 11px; line-height: 1.35; color: #000; }
.msp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 14px; }
.gov-logo { display: block; height: 66px; width: auto; flex: none; }
.msp-head h1 { font-size: 16px; text-transform: uppercase; text-align: right; max-width: 60%; margin: 0; line-height: 1.2; }
.msp-intro { margin: 0 0 12px; }
.sheet.msp h2 { font-size: 11.5px; text-transform: uppercase; margin: 12px 0 2px; }
.sheet.msp h2 span { font-weight: 700; }
.sheet.msp .box { border: 1px solid #000; }
.cells { display: grid; border-bottom: 1px solid #000; }
.cells.c3 { grid-template-columns: 1.2fr 1.1fr 1fr; }
.cells > div { padding: 3px 6px 6px; min-height: 40px; }
.cells > div + div { border-left: 1px solid #000; }
.cells label { display: block; font-size: 10.5px; }
.cells b { display: block; font-size: 13px; padding-top: 3px; }
.cells.prac b { font-weight: 400; text-align: center; font-size: 13.5px; }
.box-body { padding: 6px 12px 8px; }
.box-body h3 { font-size: 12px; margin: 0 0 4px; }
.box-body p { margin: 0 0 6px; }
.box-body ul { margin: 0 0 6px; padding-left: 18px; }
.sig-lines { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; padding: 4px 40px 0; }
.sig-lines .line { display: flex; flex-direction: column; justify-content: flex-end; min-height: 46px; text-align: center; }
.sig-lines .line > span { border-top: 1px solid #000; padding-top: 2px; font-size: 10.5px; }
.sig-lines .line b { font-size: 13px; padding-bottom: 2px; }
.sig-img { display: block; height: 42px; width: auto; max-width: 100%; margin: 0 auto -2px; object-fit: contain; }
.msp-privacy { font-size: 9.5px; margin: 12px 0 8px; }
.msp-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; font-size: 10.5px; }
.msp-foot > span { font-size: 8.5px; }
.msp-foot > div { text-align: left; }

/* Printed MSP page on the official HLTH 2947 form */
.sheet.msp-official { position: relative; container-type: inline-size; padding: 0; max-width: 8.5in; aspect-ratio: 612 / 792; }
.msp-bg { display: block; width: 100%; height: auto; }
.mf { position: absolute; font-family: Arial, Helvetica, sans-serif; color: #0a1f44; font-size: 1.85cqw; line-height: 1.2; white-space: nowrap; overflow: hidden; }
.mf.val { font-weight: 700; letter-spacing: .02em; padding-left: .4%; }
.mf.date { text-align: center; font-weight: 700; }
.mf.sig { display: flex; justify-content: center; align-items: flex-end; }
.mf.sig .sig-img { height: 100%; width: auto; max-width: 100%; margin: 0; }
.mf[data-pos="lastName"] { left: 4.90%; top: 20.58%; width: 31.70%; }
.mf[data-pos="firstName"] { left: 38.40%; top: 20.58%; width: 30.72%; }
.mf[data-pos="phn"] { left: 70.75%; top: 20.58%; width: 24.84%; }
.mf[data-pos="practitionerName"] { left: 4.90%; top: 57.32%; width: 39.54%; }
.mf[data-pos="mspNumber"] { left: 46.24%; top: 57.32%; width: 22.71%; }
.mf[data-pos="paymentNumber"] { left: 70.75%; top: 57.32%; width: 24.84%; }
.mf[data-pos="patientSig"] { left: 12.75%; top: 43.56%; width: 41.99%; height: 3.91%; }
.mf[data-pos="patientDate"] { left: 61.60%; top: 45.58%; width: 28.76%; }

/* Printed AI consent */
.sheet.ai { font-family: Arial, Helvetica, sans-serif; font-size: 13.5px; line-height: 1.55; color: #1a1a1a; display: flex; flex-direction: column; }
.ai-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 14px; margin-bottom: 40px; border-bottom: 3px solid var(--logo-teal); }
.ai-logo { display: block; height: 28px; width: auto; }
.ai-head span { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #5f6f77; font-weight: 700; }
.sheet.ai h1 { font-size: 24px; margin: 0 0 4px; color: #111; }
.ai-clinic { color: var(--brand); font-weight: 700; margin: 0 0 22px; }
.ai-body p { margin: 0 0 14px; }
.ai-body ul { list-style: none; padding: 16px 20px; margin: 4px 0 20px; background: #f3f8f8; border-radius: 10px; }
.ai-body li { position: relative; padding-left: 22px; margin: 6px 0; }
.ai-body li::before { content: "✓"; position: absolute; left: 0; color: var(--brand); font-weight: 700; }
.ai-panel { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; margin-top: 18px; padding: 18px 20px; border-radius: 12px; background: #f6f8f9; }
.ai-cell label { display: block; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: #5f6f77; font-weight: 700; margin-bottom: 4px; }
.ai-cell b { display: block; font-size: 15px; }
.ai-sig { grid-column: 1 / -1; background: #fff; border-radius: 8px; padding: 10px 14px; }
.ai-sig .sig-img { margin: 0; height: 64px; }
.blank-sig { display: block; height: 64px; }
.ai-foot { margin-top: auto; padding-top: 24px; font-size: 10px; color: #8a979d; text-align: center; }

@media print {
  @page { size: letter; margin: .4in .45in; }
  body, .print-view { background: #fff; }
  .no-print, .topbar { display: none !important; }
  .sheet { margin: 0; padding: 0; box-shadow: none; max-width: none; page-break-after: always; break-after: page; }
  .sheet:last-child { page-break-after: auto; break-after: auto; }
  .sheet.ai { min-height: 9.9in; }
  .sheet.msp-official { max-width: none; width: 100%; }
  a { color: inherit; text-decoration: none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (max-width: 860px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .rec-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .wrap { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .card { padding: 18px 16px; }
  .grid, dl, .sheet dl { grid-template-columns: 1fr; }
  .doc-boxes.cols3, .doc-boxes.cols2, .sign-row, .sig-views { grid-template-columns: 1fr; }
  .signed-date { margin-bottom: 0; }
  .sheet.msp, .sheet.ai { font-size: 12px; }
  .cells.c3 { grid-template-columns: 1fr; }
  .cells > div + div { border-left: 0; border-top: 1px solid #000; }
  .sig-lines { grid-template-columns: 1fr; padding: 4px 0 0; gap: 16px; }
  .msp-head { flex-direction: column; }
  .msp-head h1 { text-align: left; max-width: none; }
  .ai-panel { grid-template-columns: 1fr; }
  .hero h1 { font-size: 24px; }
  .actions .btn { width: 100%; }
  .sheet { padding: 20px 16px; margin: 12px 0; }
  .sheet-head { flex-direction: column; }
  .sheet-head .meta { text-align: left; flex-wrap: wrap; }
  .sign { grid-template-columns: 1fr; }
}
