@layer site {
/* Shared document wordmark for the fever table, print sheets and cut-out cards. */
.ps-brand {
  display: inline-flex;
  align-items: center;
  align-self: center;
  gap: 7px;
  margin-inline-start: auto;
  color: #262e24;
  font: 600 1rem/1 'Josefin Slab', serif;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.ps-brand img { display: block; flex: none; width: 22px; height: 22px; }

@media print {
  .ps-brand { gap: 2mm; font-size: 12pt; }
  .ps-brand img { width: 7mm; height: 7mm; }

  /* Let the name and date fields use their own line on portrait sheets. */
  .print-sheet--portrait .ps-head {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
  }
  .print-sheet--portrait .ps-head .ps-brand { grid-column: 2; grid-row: 1; }
  .print-sheet--portrait .ps-head:not(:has(.ps-field)) { grid-template-columns: minmax(0, 1fr) auto; }
}
}
@layer site {
/* Fever curve (Lev 2). Loaded only on /febertabell and /en/fever-chart, next to styles.css.
   Uses the site's tokens (see :root in input.css). Mobile first. */

/* Jump links under the PDF button */
.jump-links { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 8px; }
.jump-links a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px;
  border: 1px solid var(--separator); border-radius: 999px; background: var(--bg-card);
  color: var(--primary-dark); font-weight: 600; font-size: .9rem; text-decoration: none;
  transition: border-color .15s, background .15s;
}
.jump-links a:hover { border-color: var(--primary-light); background: var(--primary-pale); }
@media print { .jump-links { display: none; } }

/* The section */
.fever-tool { margin-top: 56px; }
.fever-tool__lead { max-width: 62ch; }
.fever-tool__facts { max-width: 62ch; }
.fever-tool__nojs {
  padding: 14px 16px; border: 1px dashed var(--primary-light); border-radius: 12px; background: var(--primary-pale);
  color: var(--text-secondary);
}
.fever-tool__app[hidden], .fc [hidden], .fever-tool__nojs[hidden] { display: none !important; }

/* The tool */
.fc { display: grid; gap: 20px; margin-top: 20px; }
/* The form. Temperature first and largest: it is the one thing that is typed every time. Date and
   time default to now. Areas keep the order on small screens and put the button on the same row
   as the fields on wide ones. */
.fc-form {
  display: grid; gap: 0 12px; align-items: start; padding: 20px;
  grid-template-columns: 1fr 1fr;
  grid-template-areas: "title title" "temp temp" "hint hint" "date time" "error error" "check check" "actions actions";
  background: var(--bg-card); border: 1px solid var(--separator); border-radius: 16px;
}
.fc-form__title { grid-area: title; margin: 0; font-size: 1.05rem; font-weight: 800; letter-spacing: -.01em; }
/* Spacing is a top margin on each row, not a grid gap, so rows that are hidden (error, check) take no room. */
.fc-form > :not(.fc-form__title) { margin-top: 14px; }
.fc-field { display: grid; gap: 6px; min-width: 0; }
.fc-field--temp { grid-area: temp; }
.fc-field--date { grid-area: date; }
.fc-field--time { grid-area: time; }
.fc-form > .fc-hint { grid-area: hint; margin-top: 6px; }
.fc-error { grid-area: error; margin-bottom: 0; }
.fc-check { grid-area: check; }
.fc-form__actions { grid-area: actions; }
.fc-field label { font-size: .85rem; font-weight: 700; color: var(--text-secondary); }
.fc-field input {
  width: 100%; min-width: 0; min-height: 48px; 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;
}
.fc-field input:hover { border-color: var(--primary); }
.fc-field input:focus-visible { outline: 3px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.fc-field input[aria-invalid="true"] { border-color: var(--error); }
/* The temperature field: larger type, a heavier border and the unit inside the field. 16 px or more
   keeps iOS from zooming the page; the decimal keypad comes from inputmode="decimal". */
.fc-tempbox { position: relative; }
.fc-field--temp .fc-tempbox input {
  min-height: 60px; padding: 8px 52px 8px 16px; font-size: 1.75rem; font-weight: 700; letter-spacing: -.01em;
  font-variant-numeric: tabular-nums; border: 2px solid var(--primary); border-radius: 12px;
}
.fc-field--temp .fc-tempbox input::placeholder { color: var(--text-muted); opacity: 1; font-weight: 600; }
.fc-tempbox__unit {
  position: absolute; top: 0; right: 16px; bottom: 0; display: flex; align-items: center;
  font-size: 1.05rem; font-weight: 700; color: var(--text-muted); pointer-events: none;
}
.fc-hint { margin: 0; font-size: .82rem; color: var(--text-muted); }
.fc-error { margin: 0; color: var(--error); font-weight: 600; font-size: .92rem; }
.fc-check { padding: 14px 16px; border-radius: 12px; background: var(--tertiary-pale); border: 1px solid var(--tertiary); }
.fc-check__title { margin: 0 0 4px; font-weight: 800; }
.fc-check__text { margin: 0 0 12px; font-size: .92rem; line-height: 1.5; color: var(--text-secondary); }
.fc-check__actions, .fc-form__actions, .fc-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* Buttons */
.fc-btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px;
  font: inherit; font-size: .92rem; font-weight: 700; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.fc-btn--small { min-height: 44px; padding: 0 12px; font-size: .85rem; }
.fc-btn:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.fc-form__actions .fc-btn--primary { flex: 1 1 200px; }

.fc-status { min-height: 1.4em; margin: -8px 0 -4px; font-size: .92rem; color: var(--text-secondary); }
.fc-undo { margin: -8px 0 0; }

/* Result: chart and table. One padding for the whole card, so the title, the name field, the chart,
   the buttons and the table share the same left and right edge. It is a div (not a section) so the
   site-wide "section[aria-labelledby]" rule does not strip the padding. */
.fc-result { display: grid; gap: 14px; padding: 20px; background: var(--bg-card); border: 1px solid var(--separator); border-radius: 16px; }
.fc-result__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; }
.fc-result__head h3 { margin: 0; font-size: 1.2rem; font-weight: 800; letter-spacing: -.01em; overflow-wrap: anywhere; }
.fc-range { margin: 0; font-size: .88rem; color: var(--text-muted); }
.fc-field--name { max-width: 380px; }
.fc-chart { width: 100%; min-height: 120px; }
.fc-chart svg { display: block; width: 100%; height: auto; }
.fc-chartnote { margin: -6px 0 0; font-size: .82rem; color: var(--text-muted); }
.fc-savehint { margin: 0; font-size: .88rem; color: var(--text-secondary); }
.fc-savehint a { color: var(--primary-dark); font-weight: 600; }
.fc-empty {
  margin: 0; display: grid; place-items: center; min-height: 160px; padding: 24px; text-align: center;
  border: 1.5px dashed var(--separator); border-radius: 12px; color: var(--text-muted); background: var(--bg-base);
}
.fc-clear-ask { font-weight: 700; margin-right: 4px; }

.fc-table-wrap { overflow-x: auto; border: 1px solid var(--separator); border-radius: 10px; background: #fff; }
.fc-table-wrap:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.fc-table { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; }
.fc-table caption { text-align: left; padding: 10px 12px; font-weight: 700; color: var(--text-secondary); }
.fc-table th, .fc-table td { padding: 8px 12px; text-align: left; border-top: 1px solid var(--separator); vertical-align: middle; }
.fc-table thead th { background: var(--primary-pale); color: var(--primary-dark); font-size: .8rem; font-weight: 700; }
.fc-table tbody th { font-weight: 600; white-space: nowrap; }
.fc-table .fc-actions { white-space: nowrap; text-align: right; }
.fc-table .fc-actions .fc-btn + .fc-btn { margin-left: 6px; }
.fc-kept { display: block; font-size: .75rem; color: var(--text-muted); }
.fc--empty .fc-table-wrap { display: none; }
.fc-footnote { margin: 0; font-size: .82rem; color: var(--text-muted); }
.fc-print-only, .fc-print-idrow { display: none; }

/* Very narrow phones (320 px): date and time on their own rows, so the whole date is readable. */
@media (max-width: 359px) {
  .fc-form { grid-template-areas: "title title" "temp temp" "hint hint" "date date" "time time" "error error" "check check" "actions actions"; }
}
@media (max-width: 519px) {
  .fc-btn--small { padding: 0 12px; font-size: .85rem; }
  .fc-form, .fc-result { padding: 16px; }
  .fc-form__actions .fc-btn--primary { flex: 1 1 100%; }
}
/* Phones: each reading is a small card, so both buttons always fit (a four-column table cut them off).
   The table keeps its meaning for screen readers through the explicit roles set in fever-chart.js. */
@media screen and (max-width: 519px) {
  .fc-table-wrap { overflow: visible; border: 0; background: transparent; border-radius: 0; }
  .fc-table, .fc-table tbody { display: block; }
  .fc-table caption { display: block; padding: 0 0 8px; }
  .fc-table thead { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .fc-table tbody tr {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin-bottom: 8px; padding: 10px 12px;
    background: #fff; border: 1px solid var(--separator); border-radius: 10px;
  }
  .fc-table tbody th, .fc-table tbody td { display: block; padding: 0; border: 0; }
  .fc-table tbody th { font-size: .95rem; }
  .fc-table tbody .fc-time { color: var(--text-secondary); }
  .fc-table tbody .fc-temp { margin-left: auto; text-align: right; font-size: 1.1rem; font-weight: 800; }
  .fc-table tbody .fc-actions { display: flex; flex: 1 0 100%; gap: 8px; margin-top: 6px; text-align: left; }
  .fc-table .fc-actions .fc-btn + .fc-btn { margin-left: 0; }
  .fc-table .fc-actions .fc-btn { flex: 1 1 0; }
  .fc-table-wrap:focus-visible { outline-offset: 4px; }
}
@media (min-width: 720px) {
  .fc-form {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr) auto; padding: 24px; align-items: start;
    grid-template-areas: "title title title title" "temp date time actions" "hint hint hint hint" "error error error error" "check check check check";
  }
  .fc-form__actions { align-self: end; }
  .fc-form__actions .fc-btn--primary { flex: 0 0 auto; min-height: 60px; }
  .fc-field--date input, .fc-field--time input { min-height: 60px; }
  .fc-result { padding: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .fc-btn, .jump-links a { transition: none; }
}

/* Printing the curve. The page prints the plain table by default (rules in input.css).
   The button sets body[data-print="kurva"], and then only the result is printed. */
@media print {
  body[data-print="kurva"] .guide > :not(#feberkurva):not(#interactive-chart) { display: none !important; }
  body[data-print="kurva"] .fever-sheet { display: none !important; }
  body[data-print="kurva"] .guide > #feberkurva,
  body[data-print="kurva"] .guide > #interactive-chart { display: block !important; margin: 0; }
  body[data-print="kurva"] .fever-tool > :not(.fever-tool__app) { display: none !important; }
  body[data-print="kurva"] .fc > :not(.fc-result) { display: none !important; }
  body[data-print="kurva"] .fc-noprint { display: none !important; }
  /* Block layout, not grid: grids split badly across pages. */
  body[data-print="kurva"] .fc-result { display: block; border: 0; padding: 0; background: #fff; }
  body[data-print="kurva"] .fc-result > * + * { margin-top: 3mm; }
  body[data-print="kurva"] .fc { display: block; margin: 0; }
  body[data-print="kurva"] .fc-table-wrap { border: 0; overflow: visible; }
  body[data-print="kurva"] .fc-table { font-size: 10pt; }
  body[data-print="kurva"] .fc-table th, body[data-print="kurva"] .fc-table td { border-color: #8a8f87; padding: 1.3mm 3mm; }
  body[data-print="kurva"] .fc-table thead { display: table-header-group; }
  body[data-print="kurva"] .fc-table thead th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body[data-print="kurva"] .fc-chart svg { max-height: 64mm; margin: 0 auto; }
  body[data-print="kurva"] .fc-table caption { display: none; }
  body[data-print="kurva"] .fc-footnote, body[data-print="kurva"] .fc-chartnote { font-size: 9pt; }
  /* Identity of the printout: brand and print date on the first page, and one line in the table header,
     which every browser repeats on each page of a long table, so no page is anonymous. */
  body[data-print="kurva"] .fc-print-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8mm;
    padding-bottom: 3mm; border-bottom: .3mm solid #B9C4B4;
  }
  body[data-print="kurva"] .fc-print-brand { display: inline-flex; align-items: center; gap: 3mm; }
  body[data-print="kurva"] .fc-print-brand img { width: 9mm; height: 9mm; }
  /* The logotype wordmark (DESIGN.md: Josefin Slab only in the wordmark), as in the site header. */
  body[data-print="kurva"] .fc-print-wordmark { font-family: 'Josefin Slab', serif; font-weight: 600; font-size: 15pt; letter-spacing: .08em; text-transform: uppercase; color: #4A4A4A; }
  body[data-print="kurva"] .fc-print-date { font-size: 9pt; color: #636365; }
  body[data-print="kurva"] .fc-print-idrow { display: table-row; }
  body[data-print="kurva"] .fc-table td.fc-print-id {
    padding: 1.2mm 3mm; border: 0; border-bottom: .3mm solid #8a8f87; font-size: 8.5pt; font-weight: 600; color: #4A4A4A;
  }
  .fc-table tr { break-inside: avoid; }
}

/* Page numbers and the site name in the page margin, for the curve printout only (a named page), where
   the browser supports page margin boxes (Chromium 131 and later). Elsewhere the browser's own print
   header and footer carry them. The page size repeats the landscape A4 of the table printout. */
@page fc-curve {
  size: A4 landscape;
  margin: 12mm;
  @bottom-right { content: counter(page) " / " counter(pages); font: 9pt/1 system-ui, sans-serif; color: #636365; }
  @bottom-left { content: "sjukstugan.se"; font: 9pt/1 system-ui, sans-serif; color: #636365; }
}
@media print {
  body[data-print="kurva"] .fc-result { page: fc-curve; }
}

/* Printable fever table: same document identity as the other sheets (wordmark top right, QR and URL in the footer). */
.fever-sheet__head { padding-bottom: 8px; border-bottom: 1.5px solid #4A4A4A; margin-bottom: 8px; }
.container .fever-sheet__foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--separator); }
.container .fever-sheet__foot p { margin: 0; font-size: .8125rem; color: var(--text-muted); max-width: 120mm; }
.fever-sheet__qr { flex: none; display: grid; justify-items: center; gap: 2px; font-size: .7rem; color: var(--text-muted); white-space: nowrap; }
.fever-sheet__qr img { display: block; width: 64px; height: 64px; }
@media screen {
  .container .fever-sheet__foot { flex-wrap: wrap; }
  .container .fever-sheet__foot p { min-width: 0; overflow-wrap: anywhere; }
  .fever-sheet__qr { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
}
@media print {
  .fever-sheet__head { padding-bottom: 2mm; margin-bottom: 3mm; border-bottom: .5mm solid #4A4A4A; }
  .container .fever-sheet__foot { margin-top: 3mm; padding-top: 2mm; border-top: .4mm solid #4A4A4A; break-inside: avoid; }
  .container .fever-sheet__foot p { font-size: 8pt; color: #4a4a4a; }
  .fever-sheet__qr { font-size: 8pt; color: #4a4a4a; } .fever-sheet__qr img { width: 17mm; height: 17mm; }
}

.guide :is([aria-labelledby="tabell-app"], [aria-labelledby="chart-app"]) > p { max-width: 600px; }

/* 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. */
/* Fever chart workspace. CSS is screen-only so existing print modes keep
   their verified pagination and data table. */
@media screen {
  [data-refined="chart"] .fever-tool { margin-block: 36px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
  [data-refined="chart"] .fever-tool__lead { max-width: 63ch; }
  [data-refined="chart"] .fc { gap: 12px; }
  [data-refined="chart"] .fc-form {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "title" "temp" "hint" "when" "quick" "error" "check" "actions";
    background: var(--sage-wash);
  }
  [data-refined="chart"] :is(.fc-form, .fc-result) { padding: clamp(16px, 2vw, 24px); }
  .fc-when { grid-area: when; display: flex; flex-wrap: wrap; gap: 10px; }
  .fc-when .fc-field--date { flex: 1 0 min(100%, 10.75rem); }
  .fc-when .fc-field--time { flex: 1 0 min(100%, 9.5rem); }
  .fc-when input { min-height: 48px; padding-inline: 10px; border-width: 1px; border-color: #788874; font-variant-numeric: tabular-nums; }
  .fc-quick { grid-area: quick; display: flex; flex-wrap: wrap; gap: 5px; }
  .fc-stepper { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 5px; }
  .fc-step { min-height: 44px; font: inherit; font-size: 1.25rem; font-weight: 760; cursor: pointer; }
  [data-refined="chart"] .fc-tempbox {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
    border: 2px solid var(--primary); border-radius: 12px; background: white;
  }
  [data-refined="chart"] .fc-field--temp .fc-tempbox input {
    min-height: 58px; padding: 6px 8px; border: 0; border-radius: 10px; font-size: 1.45rem; background: white;
  }
  [data-refined="chart"] .fc-tempbox:focus-within { outline: 3px solid var(--primary); outline-offset: 3px; }
  [data-refined="chart"] .fc-tempbox input:focus-visible { outline: none; }
  [data-refined="chart"] .fc-tempbox:has(input[aria-invalid="true"]) { border-color: var(--error); }
  [data-refined="chart"] .fc-tempbox__unit { position: static; padding-inline-end: 8px; font-size: .95rem; }
  [data-refined="chart"] .fc-result { border-radius: var(--panel-radius); font-variant-numeric: tabular-nums; }
  [data-refined="chart"] .fc-empty { color: var(--data-ink); padding: 30px 16px; background: var(--data-wash); border-radius: var(--control-radius); }
  [data-refined="chart"] .fc-status:empty { min-height: 0; margin: 0; }
  @media (min-width: 920px) {
    [data-refined="chart"] .fc { grid-template-columns: minmax(320px, 1fr) minmax(0, 1.55fr); align-items: start; column-gap: 20px; }
    [data-refined="chart"] .fc-form { grid-column: 1; grid-row: 1; }
    [data-refined="chart"] .fc-status { grid-column: 1; grid-row: 2; }
    [data-refined="chart"] .fc-undo { grid-column: 1; grid-row: 3; }
    [data-refined="chart"] .fc-result { grid-column: 2; grid-row: 1 / span 4; min-width: 0; }
  }
}

@media screen {
  [data-refined] .fever-tool__facts { max-width: 72ch; }
}
.fever-tool .fever-tool__facts { margin: 0 0 12px; font-size: .91rem; }
}
