/* ============================================================
   Carewell Clinic PMS — Global stylesheet
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Inter:wght@400;500;600;700&family=Source+Serif+4:opsz,wght@8..60,500;8..60,600;8..60,700&display=swap');

/* Palette follows womenandwombclinic.com: magenta-purple #8E1092, plum #713773, leaf green #92BD59 */
:root {
  --bg:           #F3F1F4;
  --surface:      #FFFFFF;
  --surface-alt:  #F8F5F9;
  --ink:          #2A1F2C;
  --ink-soft:     #564A58;
  --ink-muted:    #776B7C;
  --primary:      #8E1092;
  --primary-dark: #5A0C5D;
  --primary-soft: #F4E4F5;
  --plum:         #713773;
  --brand-green:  #92BD59;
  --accent:       #4A7520;
  --accent-soft:  #ECF4E1;
  --warn:         #AD3427;
  --warn-soft:    #F8E1DE;
  --success:      #46711F;
  --success-soft: #E4F0D6;
  --line:         #E6DDE8;
  --radius:       10px;
  --radius-sm:    6px;
  --shadow:       0 1px 2px rgba(60,15,62,.06), 0 6px 18px rgba(60,15,62,.07);
  --font-display: "Source Serif 4", Georgia, serif;
  --font-body:    "Inter", -apple-system, sans-serif;
  --font-mono:    "IBM Plex Mono", "Courier New", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4 { font-family: var(--font-display); color: var(--primary-dark); margin: 0 0 4px; }
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--ink); }
.hidden { display: none !important; }

/* ── Shell ─────────────────────────────────────────────── */
#app { display: flex; min-height: 100vh; }

#sidebar {
  width: 232px;
  background: var(--primary-dark);
  color: #F7EAF8;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
}
#sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-decoration: none; color: inherit;
}
#sidebar .brand .clinic { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: #fff; line-height: 1.2; }
#sidebar .brand .tag { font-size: 10px; color: var(--brand-green); letter-spacing: .06em; text-transform: uppercase; }
#sidebar nav { flex: 1; padding: 12px; overflow-y: auto; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: #EBD4EC; text-decoration: none;
  font-size: 13.5px; font-weight: 500;
  margin-bottom: 2px; cursor: pointer;
  border: none; background: none; width: 100%; text-align: left;
  transition: .12s;
}
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link.active { background: var(--primary); color: #fff; box-shadow: inset 3px 0 0 var(--brand-green); }
.nav-link .icon { width: 17px; height: 17px; flex-shrink: 0; }
#sidebar .side-foot { padding: 14px 18px; font-size: 11px; color: #C9A2CB; border-top: 1px solid rgba(255,255,255,.08); }

#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

#topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 26px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
#topbar .title { font-family: var(--font-display); font-size: 18px; color: var(--primary-dark); }
#topbar .user { display: flex; align-items: center; gap: 12px; }
#topbar .who .name { font-weight: 600; color: var(--ink); font-size: 13px; }
#topbar .who .role { color: var(--ink-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }

#content { padding: 24px; flex: 1; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  justify-content: center; padding: 9px 16px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  font-weight: 600; font-size: 13px; transition: .15s; white-space: nowrap;
  text-decoration: none;
}
.btn-primary   { background: var(--primary);  color: #fff; }
.btn-primary:hover  { background: var(--primary-dark); }
.btn-secondary { background: var(--surface);  border-color: var(--line); color: var(--ink); }
.btn-secondary:hover { background: var(--surface-alt); }
.btn-accent    { background: var(--accent);   color: #fff; }
.btn-accent:hover   { background: #3C5F1A; }
.btn-warn      { background: var(--warn);     color: #fff; }
.btn-warn:hover     { background: #9E2E22; }
.btn-ghost     { background: transparent; border-color: transparent; color: var(--accent); padding: 5px 8px; }
.btn-ghost:hover    { text-decoration: underline; }
.btn-sm        { padding: 5px 10px; font-size: 12px; }
.btn-block     { width: 100%; }
.btn:disabled  { opacity: .5; cursor: not-allowed; }

/* ── Form fields ────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 11.5px; font-weight: 600;
  color: var(--ink-soft); margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: .05em;
}
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-alt); color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--primary); outline-offset: 1px;
  border-color: var(--primary); background: var(--surface);
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.form-grid .field.full { grid-column: 1 / -1; }

/* Patient picker (appointment booking) */
.pp-results { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-top: 6px; max-height: 220px; overflow: auto; }
.pp-results:empty { display: none; }
.pp-item { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); cursor: pointer; font: inherit; color: var(--ink); }
.pp-item:last-child { border-bottom: 0; }
.pp-item:hover, .pp-item:focus { background: var(--primary-soft); outline: none; }
.pp-item small, .pp-empty { color: var(--ink-muted); font-size: 12px; }
.pp-empty { padding: 10px 12px; }
.pp-selected { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--primary); background: var(--primary-soft); border-radius: var(--radius-sm); }
.pp-selected small { color: var(--ink-soft); font-size: 12px; }
.pp-new { border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 14px; margin-top: 4px; background: var(--surface-alt); }

/* Searchable dropdown (utils.js Combo) — fixed so it is not clipped by scrolling tables */
.combo-pop { position: fixed; z-index: 1000; max-height: 240px; overflow-y: auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); font-size: 13px; }
.combo-opt { padding: 7px 10px; cursor: pointer; color: var(--ink); }
.combo-opt b { color: var(--primary); }
.combo-opt:hover, .combo-opt.active { background: var(--primary-soft); }
.combo-empty { padding: 8px 10px; color: var(--ink-muted); font-size: 12px; }
.rx-meds td { vertical-align: top; }
.rx-meds input, #rx-lab-input { width: 100%; min-width: 90px; padding: 8px 10px; font: inherit; font-size: 13px; color: var(--ink);
  background: var(--surface-alt); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.rx-meds input:focus, #rx-lab-input:focus { outline: none; border-color: var(--primary); background: var(--surface); }

/* Segmented radio choice (e.g. General / Pregnant) */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.seg label { display: flex; align-items: center; gap: 6px; margin: 0; padding: 8px 16px; cursor: pointer;
  font-size: 13.5px; text-transform: none; letter-spacing: 0; color: var(--ink); background: var(--surface); }
.seg label + label { border-left: 1px solid var(--line); }
.seg label:has(input:checked) { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.seg input { margin: 0; accent-color: var(--primary); }

/* Lab test chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 600; }
.chip button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; }

/* Patient card on the prescription page */
.rx-patient-card { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 16px;
  padding: 12px 14px; border: 1px solid var(--primary); background: var(--primary-soft); border-radius: var(--radius-sm); }
.rx-patient-card span { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-muted); }
.rx-patient-card strong { font-size: 13.5px; }
.rx-edit-banner { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px;
  margin-bottom: 14px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.field-row { display: flex; gap: 10px; }
.field-row > .field { flex: 1; }

/* ── Page header ────────────────────────────────────────── */
.view-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 18px;
}
.view-head .sub { color: var(--ink-muted); font-size: 13px; margin-top: 2px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ── Stats row ──────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat-card .num { font-family: var(--font-display); font-size: 28px; font-weight: 700; color: var(--primary-dark); }
.stat-card .lbl { font-size: 11.5px; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; }

/* ── Panel ──────────────────────────────────────────────── */
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
}
.panel h2, .panel h3 { margin-top: 0; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; margin-bottom: 14px;
}
.section-head h3 { margin: 0; }

/* ── Table ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--ink-muted);
  padding: 8px 10px; border-bottom: 2px solid var(--line); white-space: nowrap;
}
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.muted  { color: var(--ink-muted); }
.mono   { font-family: var(--font-mono); }
.empty-row td { text-align: center; color: var(--ink-muted); padding: 28px 10px; font-style: italic; }
.link-name {
  background: none; border: none; padding: 0;
  color: var(--primary-dark); font-weight: 600;
  font-size: inherit; cursor: pointer; text-align: left;
}
.link-name:hover { text-decoration: underline; color: var(--primary); }

/* ── Pills ──────────────────────────────────────────────── */
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 100px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
}
.pill-booked    { background: var(--accent-soft);  color: var(--accent); }
.pill-completed { background: var(--primary-soft); color: var(--primary-dark); }
.pill-cancelled { background: var(--warn-soft);    color: var(--warn); }
.pill-success   { background: var(--success-soft); color: var(--success); }

/* ── Modal ──────────────────────────────────────────────── */
#modal-overlay {
  position: fixed; inset: 0;
  background: rgba(42,8,44,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 16px;
}
#modal-box {
  background: var(--surface); border-radius: var(--radius);
  width: 100%; max-width: 520px; max-height: 90vh;
  overflow: auto; padding: 24px;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 16px;
}
.modal-head h3 { margin: 0; }
.modal-close { background: none; border: none; font-size: 22px; line-height: 1; color: var(--ink-muted); padding: 2px 6px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ── Toast ──────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: 320px;
}
.toast-item {
  background: var(--ink); color: #fff;
  padding: 11px 16px; border-radius: var(--radius-sm);
  font-size: 13px; box-shadow: var(--shadow);
  animation: toast-in .2s ease-out;
}
.toast-item.success { background: var(--primary-dark); }
.toast-item.warn    { background: var(--warn); }
.toast-item.error   { background: #7a1f1f; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { opacity: 1; } }

/* ── Loader ─────────────────────────────────────────────── */
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--primary);
  animation: spin .7s linear infinite; margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-row td { text-align: center; padding: 32px; }

/* ── Billing items table ─────────────────────────────────── */
.item-row input { width: 100%; }
.test-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface-alt);
  border-radius: 100px; padding: 5px 12px; font-size: 12px;
  margin: 3px 4px 0 0; cursor: pointer;
}
.test-chip:hover { border-color: var(--accent); color: var(--accent); }
.total-line {
  display: flex; justify-content: flex-end; gap: 24px;
  align-items: center; padding: 14px 4px 4px; font-size: 15px;
}
.total-line .amt { font-family: var(--font-mono); font-weight: 700; font-size: 22px; color: var(--primary-dark); }

/* ── Appointment slot ledger ─────────────────────────────── */
.slot-section h4 {
  font-family: var(--font-mono); text-transform: uppercase;
  font-size: 11px; letter-spacing: .09em; color: var(--ink-muted);
  margin: 20px 0 10px; border-bottom: 1px dashed var(--line); padding-bottom: 7px;
}
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 7px; }
.slot {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 7px 10px; background: var(--surface); text-align: left;
  transition: .12s; width: 100%;
}
.slot .time  { font-family: var(--font-mono); font-weight: 600; font-size: 12.5px; display: block; }
.slot .label { font-size: 10px; color: var(--ink-muted); margin-top: 2px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot.available { cursor: pointer; border: 1px solid var(--line); background: var(--surface); }
.slot.available:hover { border-color: var(--primary); background: var(--primary-soft); }
.slot.booked    { background: var(--accent-soft); border-color: var(--accent); cursor: pointer; }
.slot.booked .label { color: var(--accent); font-weight: 600; }
.slot.completed { background: var(--surface-alt); opacity: .7; cursor: pointer; }
.slot.cancelled { opacity: .45; cursor: default; }

/* ── Patient profile ─────────────────────────────────────── */
.profile-header { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.profile-avatar {
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 20px;
  flex-shrink: 0;
}
.profile-info { flex: 1; min-width: 200px; }
.profile-info h2 { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 20px; }
.profile-meta-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px 18px; margin-top: 12px;
}
.profile-meta-grid span { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-muted); margin-bottom: 2px; }
.profile-meta-grid .full { grid-column: 1 / -1; }
.profile-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }

/* ── Print document ─────────────────────────────────────── */
#print-area { display: none; }
.doc { font-family: var(--font-body); color: #221A24; background: #fff; padding: 6px; }
.letterhead { display: flex; align-items: center; gap: 16px; border-bottom: 3px solid var(--primary); padding-bottom: 14px; margin-bottom: 16px; }
.letterhead .clinic-name { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--primary-dark); }
.letterhead .clinic-meta { font-family: var(--font-mono); font-size: 10px; color: #6B5F6E; letter-spacing: .02em; margin-top: 4px; line-height: 1.7; }
.doc-title-row { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.doc-title-row h2 { font-size: 14px; letter-spacing: .08em; text-transform: uppercase; margin: 0; }
.doc-meta { font-size: 12px; text-align: right; line-height: 1.7; }
.patient-block { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 18px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 16px; font-size: 13px; }
.patient-block .full { grid-column: 1 / -1; }
.patient-block span { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: #85798A; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 10px; }
.doc-table th { background: var(--surface-alt); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; border: 1px solid var(--line); text-align: left; }
.doc-table td { padding: 8px 10px; border: 1px solid var(--line); }
.doc-table tfoot td { font-weight: 700; font-family: var(--font-mono); background: var(--surface-alt); }
.amount-words { font-size: 12.5px; font-style: italic; color: #564A58; margin-bottom: 6px; }
.pay-mode { font-size: 12.5px; margin-bottom: 24px; }
.doc-footer { display: flex; justify-content: space-between; align-items: flex-end; font-size: 11px; color: #85798A; margin-top: 34px; border-top: 1px solid var(--line); padding-top: 10px; }
.doc-footer .sign { font-family: var(--font-display); font-size: 13px; color: #221A24; border-top: 1px solid #221A24; padding-top: 4px; min-width: 160px; text-align: center; }
.rx-symbol { font-family: var(--font-display); font-size: 34px; font-weight: 700; color: var(--primary); line-height: 1; }
.rx-head-row { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.rx-doctor { font-size: 12.5px; line-height: 1.6; }
.rx-doctor strong { font-size: 14px; }
.diagnosis-line { font-size: 13px; margin-bottom: 14px; padding: 10px 14px; background: var(--surface-alt); border-radius: var(--radius-sm); border: 1px solid var(--line); }
.advice-block { font-size: 12.5px; margin-top: 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; background: var(--surface-alt); }

/* ── Login page ─────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--primary-dark); padding: 20px;
  background-image: radial-gradient(circle at 12% 18%, rgba(146,189,89,.16), transparent 40%),
                    linear-gradient(135deg, var(--primary) 0%, var(--plum) 55%, var(--primary-dark) 100%);
}
.login-card {
  background: var(--surface); border-radius: 14px;
  box-shadow: 0 24px 70px rgba(42,8,44,.35);
  width: 100%; max-width: 400px; padding: 38px 34px;
}
.login-card .brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.login-card .brand .clinic { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--primary-dark); }
.login-card .brand .tag { font-size: 11px; color: var(--ink-muted); letter-spacing: .04em; }
.login-card h1 { font-size: 20px; margin: 6px 0 4px; }
.login-card p.sub { color: var(--ink-muted); font-size: 13px; margin: 0 0 22px; }
.login-foot { margin-top: 18px; font-size: 12px; color: var(--ink-muted); text-align: center; }

/* ── Bottom nav (mobile) ─────────────────────────────────── */
#bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface); border-top: 1px solid var(--line);
  justify-content: space-around; padding: 5px 2px; z-index: 40;
}
#bottom-nav button {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 10px; color: var(--ink-muted);
  background: none; border: none; padding: 5px 6px; flex: 1;
  border-radius: var(--radius-sm);
}
#bottom-nav button.active { color: var(--primary); font-weight: 700; }
#bottom-nav .icon { width: 22px; height: 22px; flex-shrink: 0; }

/* "More" menu on phones — the sidebar links restyled for a light background */
.mobile-menu { display: flex; flex-direction: column; gap: 2px; }
.mobile-menu .nav-link { color: var(--ink); font-size: 15px; padding: 12px; }
.mobile-menu .nav-link .icon { width: 20px; height: 20px; }
.mobile-menu .nav-link:hover { background: var(--primary-soft); color: var(--primary-dark); }
.mobile-menu .nav-link.active { background: var(--primary); color: #fff; }

@media (max-width: 880px) {
  #sidebar { display: none; }
  #content { padding: 14px; padding-bottom: 90px; }
  #topbar  { padding: 12px 14px; }
  #bottom-nav { display: flex; }
  #toast { left: 14px; right: 14px; bottom: 90px; max-width: none; }
}

/* Prescription on the clinic letterhead: one A4 page, letterhead image behind the content.
   The image's header ends ~12% down and its purple footer starts at ~95%, so content sits between. */
.rx-page { position: relative; width: 210mm; height: 296.5mm; overflow: hidden; background: #fff;
  color: #221A24; font-family: var(--font-body); }
.rx-page-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; z-index: 0; }
.rx-page-body { position: absolute; top: 41mm; left: 15mm; right: 15mm; bottom: 42mm; z-index: 1; font-size: 12.5px; line-height: 1.45; }
.rx-page .rx-meta-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3mm; }
.rx-page .rx-symbol { font-size: 2.4em; }
.rx-page .patient-block { font-size: 1em; padding: 2.5mm 3.5mm; margin-bottom: 3mm; background: rgba(255,255,255,.75); gap: 1.5mm 6mm; }
.rx-page .patient-block span { font-size: .8em; }
.rx-page .diagnosis-line { margin-bottom: 2.5mm; }
.rx-page .doc-table { font-size: 1em; margin-bottom: 2.5mm; background: rgba(255,255,255,.75); }
.rx-page .doc-table th { font-size: .78em; padding: 1.6mm 2.2mm; background: rgba(244,228,245,.8); }
.rx-page .doc-table td { padding: 1.6mm 2.2mm; }
.rx-page .advice-block { font-size: 1em; padding: 2mm 3mm; margin-top: 0; margin-bottom: 2mm; background: rgba(255,255,255,.75); }
.rx-sign { position: absolute; right: 15mm; bottom: 20mm; z-index: 1; min-width: 62mm; text-align: center;
  font-size: 11px; line-height: 1.45; border-top: 1px solid #221A24; padding-top: 1.5mm; }
.rx-sign strong { font-size: 12.5px; }
.rx-page-note { position: absolute; left: 15mm; bottom: 21mm; z-index: 1; font-size: 9.5px; color: #776B7C; }

@media print {
  body * { visibility: hidden; }
  #print-area, #print-area * { visibility: visible; }
  #print-area { display: block !important; position: absolute; top: 0; left: 0; width: 100%; padding: 18px; }
  /* Hidden app content still takes up height — remove it so no blank extra pages print */
  #app, #bottom-nav, #toast, #modal-overlay { display: none !important; }
  #print-area.rx-print { padding: 0; }
  #print-area.rx-print .rx-page { break-after: avoid; }
}
