/* T-501 — reset, typography, focus policy, print. Every value is a token. */

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--ui);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* A3 — a real scale with weight contrast. The whole application used to live
   between 11px and 22px at one weight, so every screen read as a form even when
   it was a decision. Sizes are tokens because they change with density, and
   because a literal here is exactly what this file forbids elsewhere. */
h1, h2, h3, h4, h5, h6 { margin: 0; letter-spacing: -.014em; text-wrap: balance; }
h1 { font-size: var(--t-h1); font-weight: 600; }
h2 { font-size: var(--t-h2); font-weight: 600; }
h3 { font-size: var(--t-h3); font-weight: 600; }
h4, h5, h6 { font-size: var(--ui); font-weight: 600; }

/* Page titles. One step above h1, used by PageHeader and nothing else. */
.display { font-size: var(--t-display); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
p  { margin: 0 0 12px; }

a { color: var(--accent); text-underline-offset: 2px; }

/* One focus policy for the whole application. */
:focus-visible:not([tabindex="-1"]) { outline: none; box-shadow: var(--focus); border-radius: var(--r1); }

/* The wrapper draws the focus for a field, so the control inside it must not
   draw a second one. Without this the catch-all above put an accent ring around
   the bare input as well as around the box it sits in. */
.c-inputwrap :focus-visible,
.c-input:focus-visible,
textarea.c-input:focus-visible { box-shadow: none; }

/* Blazor moves focus to the page heading after navigation so a screen reader
   announces the new page. That target is never interactive, so it is announced
   without being outlined. */
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; box-shadow: none; }

/* Digits line up wherever they stack. Misaligned figures are the clearest
   possible signal of an unfinished product. */
.num, td.num, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.muted { color: var(--ink-3); }
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.row   { display: flex; gap: var(--gap); align-items: center; flex-wrap: wrap; }
.grow  { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
  .no-print { display: none !important; }
  body { background: #fff; color: #000; }

  /* Printing one document at a time.

     A prescription and a laboratory request are two pieces of paper going to two
     places, and a page that prints both together gives the patient one sheet the
     pharmacy has to hand back. The page sets .printing-<name> on a wrapper and
     every print-section that is not that one is left out of the run. */
  .printing-prescription .print-section:not(.print-prescription),
  .printing-requests     .print-section:not(.print-requests),
  .printing-services     .print-section:not(.print-services) { display: none !important; }

  /* Shown only on paper: the clinic's own heading, the signature rule, the
     footer. On screen they are noise; on a document handed to somebody they are
     what makes it a document. */
  .print-only { display: revert !important; }

  .print-section { page-break-after: always; }
  .print-section:last-of-type { page-break-after: auto; }
}

.print-only { display: none; }

/* The letterhead and the signature rule, which exist only on paper. */
.print-heading { margin-bottom: 12px; }
.print-heading .ph-top {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 1px solid #000; padding-bottom: 6px; font-size: 13pt;
}
.print-heading .ph-who { display: flex; gap: 18px; margin-top: 8px; font-size: 10pt; }

.signature { margin-top: 32px; font-size: 9pt; }
.signature .rule { border-bottom: 1px solid #000; width: 240px; margin-bottom: 4px; }
/* The list table. Written as class="grid" on every list page in the app. */
.grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--ui); }

.grid th {
  background: var(--surface-2); text-align: left;
  font-size: var(--ui-sm); font-weight: 600; color: var(--ink-3);
  padding: 0 12px; height: var(--row-h);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}

.grid td {
  padding: 8px 12px; border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}

.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover td { background: var(--surface-2); }
.grid tbody tr:hover td.strong { color: var(--ink); }
.grid td.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.grid td.strong { font-weight: 600; }
.grid td.right { text-align: right; }
/* A search card. The same three pieces on every list screen: the criteria, the
   two buttons, and the line that admits the page was truncated.

   The criteria lay themselves out across the card rather than stacking one per
   row: six fields down the page turns a search into a form, and a form is the
   thing people avoid filling in. */
.srch {
  display: grid; gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 10px;
}

.srch-chk {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: var(--ui-sm); color: var(--ink-2); margin-bottom: 10px;
}

.srch-go { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.srch-more { font-size: var(--ui-sm); color: var(--ink-3); }
