@layer site {
/* Printable sheets with a form (medication log, notes for a healthcare contact, handover). Loaded on those pages next to
   styles.css and fever.css (the buttons and fields reuse the .fc-* components). Mobile first. The sheet is plain
   HTML: on screen it is a paper-like card, in print it is the only thing on the page. */

.sheet-tool { margin-top: 48px; }
.sheet-tool[hidden], .ps-form[hidden], [data-ps-nojs][hidden] { display: none !important; }

/* Form */
.ps-form { display: grid; gap: 16px; margin-top: 20px; padding: 20px; background: var(--bg-card); border: 1px solid var(--separator); border-radius: 16px; }
.ps-form__title { margin: 0; font-size: 1.05rem; font-weight: 800; letter-spacing: -.01em; }
.ps-form__grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) {
  .ps-form__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ps-form__grid--row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.ps-in { display: grid; gap: 6px; min-width: 0; }
.ps-in--wide { grid-column: 1 / -1; }
.ps-in label { font-size: .85rem; font-weight: 700; color: var(--text-secondary); }
.ps-in input, .ps-in textarea {
  width: 100%; min-width: 0; padding: 10px 12px; box-sizing: border-box; font: inherit; font-size: 1rem; color: var(--text-primary);
  background: #fff; border: 1.5px solid #A9B5A5; border-radius: 10px;
}
.ps-in input { min-height: 48px; }
.ps-in textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.ps-in input:hover, .ps-in textarea:hover { border-color: var(--primary); }
.ps-in input:focus-visible, .ps-in textarea:focus-visible { outline: 3px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.ps-in [aria-invalid="true"] { border-color: var(--error); }
.ps-hint { font-size: .82rem; color: var(--text-muted); }
.ps-form__actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ps-error[hidden] { display: none; }
[data-ps-manual-copy][hidden], [data-ps-custom-box][hidden] { display: none; }
.ps-custom { border-top: 1px solid var(--separator); }
.ps-custom summary { display: list-item; min-height: 44px; align-content: center; cursor: pointer; font-weight: 700; color: var(--primary-dark); }
.ps-custom__body { display: grid; gap: 12px; justify-items: start; }
.ps-custom__body > :not(button) { width: 100%; }
.container .ps-custom__body p { margin: 0; }
.print-sheet .ps-title { max-width: 100%; overflow-wrap: anywhere; }

/* The sheet on screen */
.print-sheet {
  margin: 32px 0; padding: 20px; background: #fff; border: 1px solid var(--separator); border-radius: 12px;
  box-shadow: 0 1px 2px rgba(28, 28, 30, .05);
}
.ps-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 32px; margin-bottom: 14px; }
.container .ps-title { margin: 0; font-size: 1.25rem; font-weight: 800; color: var(--text-primary); }
.container .ps-field { margin: 0; color: var(--text-secondary); }
.ps-field span { display: inline-block; min-width: 14ch; min-height: 1.4em; border-bottom: 1px solid var(--text-muted); vertical-align: bottom; }
.ps-tablewrap { overflow-x: auto; }
.ps-table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: .8125rem; }
.ps-table th, .ps-table td { border: 1px solid var(--separator); padding: 6px 8px; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.ps-table thead th { background: var(--primary-pale); color: var(--primary-dark); font-weight: 700; }
.ps-table td { height: 30px; }

.ps-grid { display: grid; gap: 14px 24px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .ps-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ps-box { grid-column: 1 / -1; } }
.ps-line { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; margin: 0; }
.ps-label { margin: 0; font-weight: 700; font-size: .85rem; color: var(--text-secondary); }
.ps-line .ps-fill { flex: 1 1 12ch; min-height: 1.5em; border-bottom: 1px solid var(--text-muted); overflow-wrap: anywhere; }
.ps-box .ps-hint { font-weight: 400; }
.ps-fill--box {
  min-height: 22mm; margin-top: 4px; padding: 4px 6px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7;
  border: 1px solid var(--separator); border-radius: 6px;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent calc(1.7em - 1px), #d9e1d6 calc(1.7em - 1px), #d9e1d6 1.7em);
}
.ps-foot { display: flex; gap: 16px; align-items: flex-end; justify-content: space-between; margin-top: 16px; padding-top: 10px; border-top: 1px solid var(--separator); }
.container .ps-foot__text { margin: 0; font-size: .8rem; line-height: 1.5; color: var(--text-muted); }
.ps-foot__qr { flex: none; display: grid; justify-items: center; gap: 2px; font-size: .7rem; color: var(--text-muted); }
.ps-foot__qr img { display: block; width: 64px; height: 64px; }

/* Print: the sheet and nothing else. */
@page ps-landscape { size: A4 landscape; margin: 12mm; }
@page ps-portrait { size: A4 portrait; margin: 12mm; }
@media print {
  body:has(.print-sheet) { background: #fff; }
  body:has(.print-sheet) nav,
  body:has(.print-sheet) footer,
  body:has(.print-sheet) .skip-link,
  body:has(.print-sheet) .page-header,
  body:has(.print-sheet) .tool-page > :not(.sheet-tool):not(.print-sheet),
  body:has(.print-sheet) .sheet-tool > :not(.tool-ws),
  body:has(.print-sheet) .tool-ws > :not(.tool-ws__result),
  body:has(.print-sheet) .tool-ws__result > :not(.print-sheet),
  body:has(.print-sheet) .analytics-consent-banner { display: none !important; }
  body:has(.print-sheet) .container, body:has(.print-sheet) .tool-page { max-width: none; padding: 0; margin: 0; }
  .print-sheet { margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; }
  .print-sheet--landscape { page: ps-landscape; }
  .print-sheet--portrait { page: ps-portrait; }
  .ps-tablewrap { overflow: visible; }
  .ps-table { min-width: 0; font-size: 10pt; }
  .ps-table th, .ps-table td { border-color: #8a8f87; }
  .ps-table td { height: 7.4mm; padding-top: 1mm; padding-bottom: 1mm; }
  .ps-table thead th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .ps-grid { gap: 3mm 8mm; }
  .ps-head { margin-bottom: 3mm; }
  .print-sheet--portrait .ps-fill--box { margin-top: 1mm; }
  .ps-fill--box { min-height: 16mm; border-color: #8a8f87; background: repeating-linear-gradient(to bottom, transparent 0, transparent calc(1.7em - 1px), #b9c4b4 calc(1.7em - 1px), #b9c4b4 1.7em); }
  .ps-line .ps-fill { border-color: #4a4a4a; }
  .ps-foot { break-inside: avoid; border-color: #8a8f87; }
  .ps-foot__text { font-size: 8pt; color: #4a4a4a; }
  .ps-foot__qr img { width: 18mm; height: 18mm; }
  .ps-foot__qr { font-size: 7pt; color: #4a4a4a; }
  .ps-table tr, .ps-box, .ps-line { break-inside: avoid; }
}

/* Selects and message output */
.ps-in select {
  width: 100%; min-width: 0; min-height: 48px; padding-block: 10px; box-sizing: border-box; font: inherit; font-size: 1rem; color: var(--text-primary);
  background-color: #fff; border: 1.5px solid #A9B5A5; border-radius: 10px;
}
.ps-in select:focus-visible { outline: 3px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.ps-fill--out { min-height: 30mm; background: none; line-height: 1.6; }
.ps-msg { margin: 0 0 8px; font-size: 1rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.ps-msg__label { display: block; margin-bottom: 2px; font-size: .75rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }

/* VAB planner */
.vp-ui[hidden], .vp-cards[hidden], .vp-ics[hidden] { display: none !important; }
.vp-ui { display: grid; gap: 28px; margin-top: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.vp-main, .vp-aside { display: grid; gap: 14px; min-width: 0; align-content: start; }
.vp-main > h2, .vp-aside > h2 { margin: 0; }
.vp-main .fever-tool__lead, .vp-aside .fever-tool__lead { margin: 0; }
@media screen and (min-width: 960px) {
  .vp-ui { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 40px; }
  .vp-aside { position: sticky; top: 84px; padding: 20px; background: #fff; border: 1px solid var(--separator); border-radius: 16px; }
  .vp-aside .vp-cards { grid-template-columns: minmax(0, 1fr); }
}
.container .vp-from { margin: 0; font-size: .88rem; color: var(--text-muted); }
.container .vp-from:empty { display: none; }
.container .vp-note { margin: 0; padding: 12px 14px; font-size: .88rem; line-height: 1.55; color: var(--text-secondary); background: var(--bg-base); border-radius: 10px; border: 1px solid var(--separator); }
.vp-note[hidden] { display: none; }
.vp-day[data-who="both"] { border-style: double; border-width: 4px; }
.container .vp-totals--all { font-weight: 600; font-size: .9rem; }
.container .vp-totals--all:empty { display: none; }
.vp-first { max-width: 280px; }
.vp-cards { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .vp-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.vp-card { padding: 16px 18px; border-radius: 14px; background: var(--primary-pale); border: 1px solid var(--primary-light); }
.container .vp-card p { margin: 0; }
.container .vp-card__h { font-size: .78rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--primary-dark); }
.container .vp-card__date { margin: 2px 0 6px; font-size: 1.15rem; font-weight: 800; color: var(--text-primary); }
.container .vp-card__t { font-size: .88rem; line-height: 1.55; color: var(--text-secondary); }
.vp-ics { display: grid; gap: 6px; margin: 0; }
.vp-pick { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .vp-pick { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.vp-fs { margin: 0; padding: 0; border: 0; display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.vp-fs legend { padding: 0; margin-bottom: 6px; font-size: .85rem; font-weight: 700; color: var(--text-secondary); }
.vp-radio { position: relative; }
.vp-radio input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.vp-radio span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: 1.5px solid #A9B5A5; border-radius: 999px; background: #fff; font-size: .92rem; font-weight: 600; color: var(--text-primary); }
.vp-radio input:checked + span { background: var(--action-pressed); border-color: var(--primary); color: var(--primary-dark); }
.vp-radio input:focus-visible + span { outline: 3px solid var(--primary); outline-offset: 2px; }
.vp-person-mark { display: inline-block; width: .65em; height: .65em; flex: none; background: #3c6335; border-radius: 50%; }
.vp-person-mark[data-person="1"] { background: #325a8a; border-radius: 0; }
.vp-person-mark[data-person="2"] { background: #8a4e2d; border-radius: 0; transform: rotate(45deg) scale(.85); }
.vp-radio .vp-person-mark { margin-right: 8px; }
.vp-radio input:checked + span .vp-person-mark { background: #fff; }
.vp-token { display: flex; justify-content: flex-start; align-items: center; gap: 2px; white-space: nowrap; }
.vp-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.container .vp-month { margin: 0; font-size: 1.1rem; font-weight: 800; text-transform: capitalize; }
.vp-nav .fc-btn { min-width: 48px; font-size: 1.4rem; }
.vp-cal { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 4px; }
.vp-cal th { font-size: .75rem; font-weight: 700; color: var(--text-muted); padding: 2px 0; text-align: center; }
.vp-cal abbr { text-decoration: none; }
.vp-cal td { padding: 0; }
.vp-day { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; width: 100%; min-height: 56px; padding: 2px; border: 1.5px solid var(--separator); border-radius: 10px; background: #fff; font: inherit; color: var(--text-primary); cursor: pointer; }
.vp-day:hover { border-color: var(--primary); }
.vp-day:focus-visible { outline: 3px solid var(--primary); outline-offset: 1px; }
.vp-day__n { font-size: .95rem; font-weight: 700; }
.vp-day__t { font-size: .62rem; line-height: 1.1; font-weight: 700; }
.vp-day[aria-pressed="true"] { background: var(--primary-pale); border-color: var(--primary); }
.vp-day[data-who="1"] { border-style: dashed; }
.vp-day[data-who="2"] { border-style: dotted; }
.container .vp-totals { margin: 0; font-weight: 700; color: var(--text-secondary); }
.vp-child { max-width: 320px; }
.container .vp-src { font-size: .85rem; color: var(--text-muted); }
.vp-grid { width: 100%; table-layout: fixed; border-collapse: collapse; margin-top: 8px; }
.vp-grid th, .vp-grid td { border: 1px solid var(--separator); padding: 4px 6px; text-align: left; vertical-align: top; }
.vp-grid thead th { background: var(--primary-pale); color: var(--primary-dark); font-size: .78rem; }
.vp-grid td { height: 64px; }
.vp-n { display: block; font-size: .85rem; font-weight: 800; }
.vp-m { display: block; font-size: .72rem; color: var(--text-secondary); }
.vp-sum, .vp-keys { display: flex; flex-wrap: wrap; gap: 4px 24px; margin-top: 12px; }
.vp-sum p, .vp-keys p { margin: 0; }
.vp-sum span, .vp-keys span { display: inline-block; min-width: 8ch; border-bottom: 1px solid var(--text-muted); }
.vp-keys .ps-label { flex: 1 0 100%; }
.vp-key-list { flex-basis: 100%; }
.vp-key-list ul { margin: 4px 0 0; padding-inline-start: 1.2em; }
.vp-key-list li { break-inside: avoid; }
@media print {
  .vp-grid th, .vp-grid td { border-color: #8a8f87; }
  .vp-grid td { height: 24mm; }
  .vp-grid thead th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .vp-sum span, .vp-keys span { border-color: #4a4a4a; }
  .vp-sum { break-inside: avoid; }
  .vp-person-mark { background: #1c1c1e !important; print-color-adjust: exact; }
  body:has(.print-sheet) .vp { display: none !important; }
}

/* Discreet identity on every sheet: small logo and name, top right. */
.ps-fill--out:empty { min-height: 60mm; background: repeating-linear-gradient(to bottom, transparent 0, transparent calc(1.7em - 1px), #d9e1d6 calc(1.7em - 1px), #d9e1d6 1.7em); }
.ps-foot__qr { max-width: 44mm; text-align: center; overflow-wrap: anywhere; }
@media print { .ps-fill--out:empty { min-height: 80mm; background: repeating-linear-gradient(to bottom, transparent 0, transparent calc(1.7em - 1px), #b9c4b4 calc(1.7em - 1px), #b9c4b4 1.7em); } .ps-foot__qr { max-width: 38mm; } }

/* Two different things, side by side: the digital tool and the blank PDF. */
.guide-actions .btn-secondary { display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px; font-weight: 700; text-decoration: none; }
.tool-page .sheet-tool { margin-top: 28px; scroll-margin-top: 84px; }

/* The medication log uses a timeline on screen and the table on paper. */
@media screen { .print-sheet--medlog-ready { display: none; } }
@media screen and (max-width: 719px) {
  .ps-table { min-width: 0; }
  .ps-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .ps-table, .ps-table tbody, .ps-table tr { display: block; }
  .ps-table tbody tr { position: relative; margin: 0 0 10px; padding: 8px 40px 8px 12px; border: 1px solid var(--separator); border-radius: 10px; background: #fff; }
  .ps-table td { display: grid; grid-template-columns: 9.5em minmax(0, 1fr); gap: 8px; height: auto; padding: 3px 0; border: 0; }
  .ps-table td:empty { display: none; }
  .ps-table td::before { content: attr(data-label); font-weight: 700; color: var(--text-secondary); }
}

.med-timeline {
  padding: 20px; background: var(--bg-card); border: 1px solid var(--separator); border-radius: 16px;
  overflow-wrap: anywhere;
}
.med-timeline__heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; }
.med-timeline__heading h3 { margin: 0; font-size: 1.1rem; font-weight: 800; }
.med-timeline__heading h3:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
.container .med-timeline .ps-count { margin: 0; font-size: .875rem; color: var(--text-muted); }
.container .med-timeline__empty { margin: 8px 0 0; }
.med-timeline h4 { margin: 18px 0 7px; color: var(--primary-dark); font-size: .9rem; font-weight: 800; }
.med-timeline__list { list-style: none; margin: 0; padding: 0; }
.med-timeline__list li {
  display: grid; position: relative; grid-template-columns: minmax(3.5rem, auto) minmax(0, 1fr);
  align-items: start; gap: 8px; padding: 8px 0 4px 15px; margin: 0 0 0 4px; border-left: 1px solid var(--primary-light);
}
.med-timeline__list li::before {
  content: ''; position: absolute; top: 16px; left: -4px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--primary);
}
.med-timeline__time { color: var(--primary-dark); font-size: .9rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.med-timeline__details { min-width: 0; }
.med-timeline__details strong { display: block; color: var(--text-primary); font-weight: 800; }
.med-timeline__details dl { display: grid; gap: 2px; margin: 3px 0 0; font-size: .9rem; }
.med-timeline__details dl div { display: flex; flex-wrap: wrap; gap: 0 7px; }
.med-timeline__details dt { font-weight: 700; }
.med-timeline__details dd { margin: 0; }
.med-timeline__actions { display: flex; flex-wrap: wrap; gap: 2px 8px; }
.med-timeline__actions .fc-btn { min-height: 44px; padding: 0 8px; font-size: .875rem; }

/* Workspace: the form and result stack on phones and sit side by side at larger widths. */
.tool-ws { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); margin-top: 16px; align-items: start; }
.tool-ws .ps-form { margin-top: 0; }
.tool-ws .print-sheet { margin: 0; }
.tool-ws--medlog .ps-form__grid--row .ps-in { grid-template-rows: 1fr auto; }
@media screen and (min-width: 960px) {
  .tool-ws--portrait { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 32px; }
  .tool-ws--portrait .tool-ws__result { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; }
  .tool-ws--medlog { grid-template-columns: minmax(0, 5fr) minmax(0, 4fr); gap: 24px; }
}
@media print { .tool-ws { display: block; margin: 0; } }

/* Message output: the generated text is the main thing on the page. */
.container .msg-out__h { margin: 0; font-size: 1.05rem; font-weight: 800; }
.container .msg-card__label { margin: 0; font-size: .75rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--primary-dark); }
.container .msg-card__text { margin: 0; font-size: 1.05rem; line-height: 1.65; color: var(--text-primary); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-card__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.container .msg-out__note { margin: 0; font-size: .88rem; color: var(--text-secondary); }

/* The tool's short facts come after the tool, as a quiet note. */
.tool-facts { margin-top: 20px; }
.fc-btn[hidden], .ps-form button[hidden] { display: none !important; }

/* Grouped form sections */
.ps-group { margin: 0; padding: 14px 0 0; border: 0; border-top: 1px solid var(--separator); min-width: 0; }
.ps-group legend { padding: 0 10px 0 0; font-size: .78rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--primary-dark); }
.ps-group .ps-form__grid { margin-top: 4px; }
.ps-form .ps-group:first-of-type { border-top: 0; padding-top: 0; }

/* ===== Document identity for every sheet (order 011): wordmark, even ruled lines, one footer with QR and URL ===== */
.ps-head { padding-bottom: 8px; border-bottom: 1.5px solid #4A4A4A; }
.container .ps-title { font-size: 1.35rem; }
.ps-wrap { position: relative; margin-top: 1mm; }
.ps-rules { position: absolute; inset: 0 0 auto 0; display: block; pointer-events: none; }
.ps-rules i { display: block; height: 26px; border-bottom: 1px solid #8a8f87; }
.ps-fill--box, .ps-fill--out, .ps-fill--out:empty {
  position: relative; min-height: 26px; margin: 0; padding: 0; border: 0; border-radius: 0; background: none;
  font-size: .95rem; line-height: 26px; color: var(--text-primary);
}
.ps-wrap .ps-fill--box { min-height: 0; }
.ps-msg { margin: 0; line-height: 26px; }
.ps-msg + .ps-msg { margin-top: 26px; }
.ps-foot { align-items: center; }
.ps-foot__qr { max-width: none; white-space: nowrap; }
.ps-foot__qr img { width: 76px; height: 76px; }
@media print {
  .print-sheet--portrait { display: flex; flex-direction: column; min-height: 270mm; }
  .print-sheet--portrait .ps-grid { align-content: start; gap: 3mm 8mm; }
  .print-sheet--portrait .ps-foot { margin-top: auto; padding-top: 4mm; border-top: .4mm solid #4A4A4A; }
  .ps-head { margin-bottom: 5mm; padding-bottom: 2mm; border-bottom: .5mm solid #4A4A4A; }
  .ps-title, .container .ps-title { font-size: 17pt; }
  .ps-label { font-size: 9.5pt; color: #1c1c1e; }
  .ps-line .ps-fill { border-bottom: .3mm solid #4a4a4a; min-height: 7mm; }
  .ps-fill--box, .ps-fill--out, .ps-fill--out:empty { font-size: 10.5pt; }
  .ps-rules i { border-bottom-color: #6f756c; }
  .ps-foot__text { font-size: 8pt; max-width: 120mm; }
  .ps-foot__qr { font-size: 8pt; } .ps-foot__qr img { width: 22mm; height: 22mm; }
  .ps-box { break-inside: avoid; }
}
@media print {
  .sheet-tool, .tool-page .sheet-tool { margin: 0; padding: 0; }
  .page-container, body:has(.print-sheet) .page-container { margin: 0; }
  body:has(.print-sheet) main, body:has(.print-sheet) .container { padding: 0 !important; margin: 0 !important; }
}
@media print { .print-sheet--landscape .ps-foot__qr img { width: 17mm; height: 17mm; } .print-sheet--landscape .ps-foot { padding-top: 2mm; margin-top: 3mm; } }
@media print { main#main-content, body:has(.print-sheet) main#main-content { padding: 0 !important; margin: 0 !important; min-height: 0 !important; } }
@media print { body:has(.print-sheet) { min-height: 0 !important; display: block !important; } body:has(.print-sheet) main { flex: none !important; } }

.ps-wrap--l1 { min-height: 27px; }
.ps-wrap--l2 { min-height: 53px; }
.ps-wrap--l3 { min-height: 79px; }
.ps-wrap--l4 { min-height: 105px; }
.ps-wrap--l5 { min-height: 131px; }
.ps-wrap--l6 { min-height: 157px; }
.ps-wrap--l7 { min-height: 183px; }
.ps-wrap--l8 { min-height: 209px; }
.ps-wrap--l9 { min-height: 235px; }
.ps-wrap--l10 { min-height: 261px; }
.ps-wrap--l11 { min-height: 287px; }
.ps-wrap--l12 { min-height: 313px; }
@media print { .ps-head { gap: 2mm 8mm; } .ps-field span { min-width: 11ch; } }
@media print {
  .print-sheet:has([data-ps-custom-box]:not([hidden])) .ps-grid { row-gap: 2mm; }
  .print-sheet:has([data-ps-custom-box]:not([hidden])) .ps-wrap--l1 { min-height: 21px; }
  .print-sheet:has([data-ps-custom-box]:not([hidden])) .ps-wrap--l2 { min-height: 41px; }
  .print-sheet:has([data-ps-custom-box]:not([hidden])) .ps-wrap--l3 { min-height: 61px; }
  .print-sheet:has([data-ps-custom-box]:not([hidden])) .ps-wrap--l4 { min-height: 81px; }
  .print-sheet:has([data-ps-custom-box]:not([hidden])) .ps-rules i { height: 20px; }
  .print-sheet:has([data-ps-custom-box]:not([hidden])) .ps-fill--box { line-height: 20px; }
}

/* Print-only sheets (scripts/lib/print-pages.js): year sheet and home medicine list. */
.tool-ws--solo { grid-template-columns: minmax(0, 1fr); }
.tool-ws--solo .tool-ws__result { position: static; max-height: none; overflow: visible; }
.ps-legend { display: flex; flex-wrap: wrap; gap: 4px 24px; margin: 0 0 10px; font-size: .85rem; color: var(--text-secondary); }
.ps-year { width: 100%; min-width: 880px; border-collapse: collapse; table-layout: fixed; font-size: .72rem; }
.ps-year th, .ps-year td { border: 1px solid var(--text-muted); padding: 0; text-align: center; height: 24px; }
.ps-year thead th { background: var(--primary-pale); color: var(--primary-dark); font-weight: 700; }
.ps-year .ps-year__m { width: 74px; text-align: left; padding: 0 6px; }
.ps-year .ps-year__sum { width: 52px; }
.ps-year .ps-year__d { font-size: .68rem; }
.year-editor[hidden], .year-months[hidden], [data-year-fallback][hidden] { display: none; }
.year-editor { display: grid; gap: 12px; justify-items: start; width: 100%; max-width: 550px; }
.container .year-editor p { margin: 0; }
.year-editor__period { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 12px; width: 100%; }
.year-editor .vp-cal { border-spacing: 3px; }
.year-editor .vp-day { min-height: 48px; }
.year-editor .vp-day[data-marked] { background: var(--primary-pale); border-color: var(--primary); }
.year-editor__totals { display: grid; gap: 8px 28px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 155px), 1fr)); width: 100%; margin: 0 0 6px; }
.year-editor__totals dt { color: var(--text-secondary); font-weight: 600; }
.year-editor__totals dd { margin: 0; font-variant-numeric: tabular-nums; }
.year-months { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.year-months caption { text-align: start; font-size: 1.05rem; font-weight: 700; margin-bottom: 8px; }
.year-months th, .year-months td { padding: 6px 8px; border-bottom: 1px solid var(--separator); text-align: end; }
.year-months tr > :first-child { text-align: start; }
.year-months thead { color: var(--primary-dark); background: var(--primary-pale); }
@media screen { .year-tool--ready .print-sheet { display: none; } }
@media screen and (min-width: 800px) { .year-tool--ready .tool-ws { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 32px; } }
.ps-table--inventory { min-width: 0; }
.ps-table--inventory td { height: 34px; }
@media print {
  .ps-year { min-width: 0; font-size: 7pt; }
  .ps-year th, .ps-year td { height: 8.6mm; border-color: #4A4A4A; }
  .ps-year .ps-year__m { width: 20mm; }
  .ps-year .ps-year__sum { width: 14mm; }
  .ps-table--inventory { min-width: 0; font-size: 9pt; }
  .ps-table--inventory td { height: 9.2mm; border-color: #4A4A4A; }
  .ps-table--inventory th { border-color: #4A4A4A; }
  .ps-legend { color: #4A4A4A; font-size: 8pt; }
}

.tool-ws--solo .tool-ws__result, .tool-ws--solo .print-sheet { min-width: 0; max-width: 100%; }
.tool-ws--solo .ps-head { min-width: 0; }
@media screen { .ps-foot { flex-wrap: wrap; } .ps-foot__qr { min-width: 0; max-width: 100%; } .ps-foot__qr span { overflow-wrap: anywhere; } }

/* WEB-025/026: web-to-app note and bookmark hint under a tool. */
.ps-appnote { margin: 24px 0 0; padding: 12px 14px; font-size: .9rem; color: var(--text-secondary); background: var(--bg-card); border: 1px solid var(--separator); border-radius: 12px; }
.ps-appnote p { margin: 0; }
.ps-appnote p + p, .ps-appnote p[hidden] + p { margin-top: 8px; }
.ps-appnote [hidden] { display: none; }
@media print { .ps-appnote { display: none !important; } }

/* Mobile form grouping: short fields (date, time) sit side by side, free-text fields keep the full width. */
@media (max-width: 639.98px) and (min-width: 340px) {
  .ps-form__grid, .ps-form__grid--row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 10px; }
  .ps-form__grid .ps-in:not(:has(input[type="date"], input[type="time"])) { grid-column: 1 / -1; }
}

/* The VAB planner on a phone: the printable sheet is a print/PDF artefact, so it is not repeated under the interactive calendar
   on a small screen (it is still in the page and prints as before). Order 013, mobile compaction. */
@media screen and (max-width: 719px) { .sheet-tool .print-sheet[data-sheet="vabplanner"] { display: none; } }

/* Home medicine inventory: edit in the workspace, print the shared sheet. */
.inventory-tool [hidden], .guide-actions [data-inventory-link][hidden], .guide-actions [data-inventory-fallback-link][hidden] { display: none !important; }
.inventory-tool .ps-in textarea { min-height: 68px; }
.inventory-list { border: 1px solid var(--separator); background: var(--bg-card); border-radius: 16px; padding: 20px; }
.inventory-list__head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; }
.inventory-tool .inventory-list__head h3,
.inventory-tool .ps-form__title { margin: 0; font-size: 1.05rem; }
.inventory-list__controls { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); margin: 16px 0; }
.inventory-list__controls select { min-height: 48px; width: 100%; min-width: 0; padding-block: 8px; border-radius: 10px; border: 1.5px solid #A9B5A5; font: inherit; background-color: #fff; color: var(--text-primary); }
.inventory-list__controls select:focus-visible { outline: 3px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.inventory-tool .inventory-list__empty { margin: 10px 0 0; color: var(--text-muted); }
.guide .inventory-list__rows { margin: 0; padding: 0; list-style: none; }
.guide .inventory-list__rows > li { border-top: 1px solid var(--separator); padding: 12px 0 8px; margin: 0; overflow-wrap: anywhere; }
.guide .inventory-list__rows > li::before { content: none; }
.inventory-list__rows dl { margin: 4px 0 0; font-size: .9rem; }
.inventory-list__rows dl div { display: flex; flex-wrap: wrap; gap: 0 8px; }
.inventory-list__rows dt { font-weight: 700; }
.inventory-list__rows dd { margin: 0; min-width: 0; white-space: pre-wrap; }
.inventory-list__actions { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 4px; }
.inventory-list__actions .fc-btn { min-height: 44px; padding: 0 8px; }
@media screen {
  .inventory-tool--ready .print-sheet { display: none; }
}
@media screen and (min-width: 360px) {
  .inventory-tool .inventory-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inventory-tool .inventory-fields .ps-in:not(.ps-in--wide) { grid-column: auto; }
}
@media screen and (min-width: 960px) {
  .inventory-tool--ready .tool-ws { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
  .inventory-list__controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media print {
  .print-sheet--inventory-filled { display: block; min-height: 0; }
  .print-sheet--inventory-filled .ps-table { table-layout: fixed; }
  .print-sheet--inventory-filled .ps-table td { min-height: 0; height: auto; white-space: pre-wrap; }
  .print-sheet--inventory-filled .ps-table th:nth-child(3) { width: 12%; }
  .print-sheet--inventory-filled .ps-table th:last-child { width: 25%; }
  .print-sheet--inventory-filled .ps-foot { margin-top: 5mm; }
}


/* Moved from src/refinement.css (order 027, DES-011): this page type's rules from orders 020–024, after the file's own rules as before. */
/* Documents and statistics. Adaptive layouts keep the screen and the printable file distinct. */
@media screen {
  [data-refined] .sheet-tool { margin-top: clamp(24px, 4vw, 42px); }
  [data-refined] .tool-ws {
    gap: clamp(12px, 2vw, 24px); padding: clamp(10px, 2vw, 22px);
    border-radius: var(--panel-radius); background: var(--sage-wash);
  }
  [data-refined] .tool-ws__result { min-width: 0; }
  [data-refined] .tool-ws .ps-form { border-color: var(--line); padding: clamp(12px, 2vw, 22px); }
  [data-refined] .ps-form__title { font-size: 1.15rem; }
  [data-refined] .ps-group legend { text-transform: none; letter-spacing: 0; font-size: .95rem; }
  [data-refined] .ps-form__grid { container-type: inline-size; }
  [data-refined] .ps-in :is(input, select, textarea) {
    font-variant-numeric: tabular-nums; border-width: 1px; border-color: #788874;
  }
  [data-refined] .ps-in :is(input, select, textarea):hover { border-color: var(--primary); }
  [data-refined] .ps-in [aria-invalid="true"] { border-color: var(--error); }
  [data-refined] .ps-in :is([type="date"], [type="time"]) { max-width: 100%; }
  @container (max-width: 18em) {
    [data-refined] .ps-form__grid > .ps-in { grid-column: 1 / -1; }
  }
  [data-refined] .tool-ws__result > .print-sheet { border-radius: 3px; box-shadow: var(--sheet-shadow); }
  [data-refined] .ps-custom { margin-top: 4px; padding-top: 4px; }
  [data-refined] :is(.inventory-list__empty, .med-timeline__empty) {
    padding: 14px; border-radius: var(--control-radius); background: var(--data-wash); color: var(--data-ink);
  }
  [data-refined] .med-timeline { background: var(--surface); }
  [data-refined] .med-timeline__list { border-inline-start: 1px solid var(--line); padding-inline-start: 12px; }
  [data-refined] .med-timeline__time { color: var(--data-ink); }
  [data-refined] .msg-card__label { text-transform: none; letter-spacing: 0; }
  [data-refined] .vp-main, [data-refined] .vp-aside, [data-refined] .year-editor {
    padding: clamp(10px, 2vw, 22px); border-radius: var(--panel-radius);
  }
  [data-refined] .vp-main, [data-refined] .year-editor { background: var(--sage-wash); }
  [data-refined] .vp-aside { background: var(--data-wash); border-color: #b7c8cb; position: static; }
  [data-refined] .vp-card { background: var(--surface); border-color: #b7c8cb; }
  [data-refined] .vp-day { font-variant-numeric: tabular-nums; }
  [data-refined] .vp-day[aria-pressed="true"] { background: #dce8ee; }
  [data-refined] .year-editor { max-width: 100%; }
  [data-refined] .year-editor__totals { border-top: 1px solid var(--line); padding-top: 14px; }
}
@media screen and (min-width: 960px) {
  [data-refined] .tool-ws--portrait:not(.tool-ws--solo) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  [data-refined] .tool-ws--portrait .tool-ws__result { position: static; max-height: none; overflow: visible; }
}
}
