@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@600;700&display=swap');

:root {
  --bg: #f5f6f8;
  --card-bg: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --accent: #2563eb;
  --border: #e5e7eb;
  --error: #b91c1c;
  --error-bg: #fef2f2;
  --brand-blue: #1e40af;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
header {
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
header h1 {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 52px;
  font-weight: 700;
  color: var(--brand-blue);
  margin: 0;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.header-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
header a { font-size: 11px; color: var(--accent); text-decoration: none; }
#status { font-size: 11px; color: var(--muted); }
#status.ok { color: #15803d; }
#status.bad { color: var(--error); }
#stampsStatus { font-size: 11px; }
main { max-width: 1900px; margin: 0 auto; padding: 24px 28px 64px; }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-spacer { flex: 1; min-width: 0; }

.history-calendar-wrap { position: relative; }
.history-calendar {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 10;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12); padding: 12px; width: 260px;
}
.calendar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.calendar-title { font-size: 13px; font-weight: 600; }
.calendar-header .btn { padding: 3px 8px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.calendar-dow { font-size: 11px; color: var(--muted); text-align: center; padding: 2px 0; }
.calendar-cell {
  font-size: 13px; text-align: center; padding: 6px 0; border-radius: 6px; cursor: pointer;
}
.calendar-cell:hover { background: var(--bg); }
.calendar-cell.empty { cursor: default; }
.calendar-cell.out-of-range { color: var(--muted); opacity: 0.4; cursor: default; pointer-events: none; }
.calendar-cell.has-data { background: #dbeafe; color: #1e40af; font-weight: 700; }
.calendar-cell.has-data:hover { background: #bfdbfe; }
.calendar-cell.is-today { box-shadow: inset 0 0 0 1.5px var(--accent); }
.calendar-legend {
  display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted);
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border);
}
.calendar-dot { width: 10px; height: 10px; border-radius: 3px; background: #dbeafe; display: inline-block; }

/* Postage Log panel (In Office page only) - reuses .history-calendar's
   dropdown positioning/shadow, just wider to fit result rows. */
.postage-log-panel { width: 340px; max-height: 420px; overflow-y: auto; }
.postage-log-search { display: flex; gap: 6px; margin-bottom: 8px; }
.postage-log-search input {
  flex: 1; min-width: 0; padding: 6px 8px; font-size: 13px;
  border: 1px solid var(--border); border-radius: 6px;
}
.postage-log-presets { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }

/* Patient search, in the toolbar itself rather than behind a button -
   the board only holds a fortnight now, so finding an older case is an
   ordinary move, not an occasional one. */
.lab-search-input {
  width: 200px; padding: 6px 8px; font-size: 13px;
  border: 1px solid var(--border); border-radius: 6px;
}

/* Suggestions under the box. Positioned against a wrapper rather than
   the toolbar so it hangs off the field itself, and floated above the
   board rather than pushing it down - the list appears and disappears on
   every keystroke, and a board that jumped each time would be unusable. */
.lab-search-wrap { position: relative; display: inline-block; }
.lab-suggest {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 60;
  min-width: 240px; max-height: 260px; overflow-y: auto;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.14);
}
.lab-suggest-row { padding: 7px 10px; font-size: 13px; cursor: pointer; }
.lab-suggest-row:hover { background: var(--accent); color: #fff; }
.lab-suggest-empty { padding: 7px 10px; font-size: 12.5px; color: var(--muted); }
.postage-log-list { display: flex; flex-direction: column; gap: 8px; }
.postage-log-row { padding-bottom: 8px; border-bottom: 1px solid var(--border); font-size: 13px; }
.postage-log-row:last-child { border-bottom: none; padding-bottom: 0; }

.btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 14px;
}
.btn:hover { opacity: 0.9; }
.btn:disabled { background: #d1d5db; border-color: #d1d5db; color: #6b7280; cursor: not-allowed; opacity: 1; }
.btn-secondary {
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
}
.btn-small { padding: 5px 10px; font-size: 13px; }
.btn-tiny { padding: 2px 6px; font-size: 11px; }
table { width: 100%; border-collapse: collapse; background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--muted); font-weight: 500; background: #fafafa; }
tr:last-child td { border-bottom: none; }
.sub { color: var(--muted); font-size: 13px; }
.error-box { background: var(--error-bg); color: var(--error); border-radius: 6px; padding: 10px 12px; font-size: 13px; margin-top: 12px; }
.ok-box { background: #f0fdf4; color: #15803d; border-radius: 6px; padding: 10px 12px; font-size: 13px; margin-top: 8px; }
.empty-box { color: var(--muted); padding: 30px; text-align: center; }
.warn-box {
  background: #fffbeb; color: #92400e; border: 1px solid #fde68a;
  border-radius: 6px; padding: 10px 12px; font-size: 13px; margin-bottom: 16px;
}
.error-row td { background: var(--error-bg); color: var(--error); }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 24px 0 10px; }
.section-title:first-child { margin-top: 0; }
/* Four across (was three): the board carries a fortnight of cards
   rather than one day's, so fitting more of them on screen matters more
   than the extra width per card. Steps down rather than squeezing -
   below 1200px a quarter-width card can't hold a tray range and a
   button on one line. */
.ready-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.ready-grid .ready-card { padding: 12px; gap: 5px; }
.ready-grid .ready-card .name { font-size: 15px; }
.ready-grid .ready-card .meta { font-size: 12px; }
@media (max-width: 1200px) {
  .ready-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 820px) {
  /* Still readable on a narrower window/tablet - drop to 2, then 1 */
  .ready-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .ready-grid { grid-template-columns: 1fr; }
}
.ready-card {
  background: #f0fdf4; border: 1px solid #86efac; border-radius: 10px;
  padding: 16px; display: flex; flex-direction: column; gap: 6px;
}
.ready-card .name { font-size: 16px; font-weight: 600; }
/* Age sits with the name because that is where you are already looking,
   and reads as a quiet annotation rather than another data point
   competing with the status. */
.card-age {
  font-size: 12px; font-weight: 600; color: #166534;
  background: #dcfce7; border: 1px solid #86efac; border-radius: 999px;
  padding: 1px 7px; margin-left: 4px; vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.ready-card .meta { font-size: 13px; color: #166534; }
.ready-card .btn { margin-top: 8px; align-self: flex-start; background: #16a34a; border-color: #16a34a; }
.waiting-table { opacity: 0.85; }
.waiting-table table { background: #fafafa; }
.lab-review-table { font-size: 13.5px; margin-bottom: 4px; }
.lab-review-table code { font-size: 12.5px; }
.lab-review-match { color: #166534; font-weight: 600; }
.chart-fields { border-top: 1px dashed #86efac; margin-top: 6px; padding-top: 6px; }
.chart-field { font-size: 13px; color: #166534; }
.chart-field-name { font-weight: 600; }
.btn-postage { background: #7c3aed; border-color: #7c3aed; margin-top: 4px; }
.postage-panel {
  border-top: 1px dashed #86efac; margin-top: 8px; padding-top: 8px;
  display: flex; flex-direction: column; gap: 4px;
}
.rate-option {
  display: flex; justify-content: space-between; align-items: center;
  background: white; border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 10px; font-size: 13px; cursor: pointer;
}
.rate-option:hover { background: #f5f6f8; }
.rate-price { font-weight: 700; }

/* Tray labels printed -> yellow. Postage printed -> red (takes priority
   over yellow if both are true - postage is the more final/costly step). */
.ready-card.trays-printed {
  background: #fefce8;
  border-color: #fde047;
}
.ready-card.trays-printed .meta,
.ready-card.trays-printed .chart-field { color: #854d0e; }
.ready-card.trays-printed .chart-fields { border-top-color: #fde047; }
.ready-card.trays-printed .btn { background: #ca8a04; border-color: #ca8a04; }

.ready-card.postage-printed {
  background: #fef2f2;
  border-color: #fca5a5;
}
.ready-card.postage-printed .meta,
.ready-card.postage-printed .chart-field { color: #991b1b; }
.ready-card.postage-printed .chart-fields { border-top-color: #fca5a5; }
.ready-card.postage-printed .btn { background: #dc2626; border-color: #dc2626; }

/* Arch Form: outside lab already made the trays, so no green/yellow/red
   workflow applies - just a distinct blue so it reads as "different"
   rather than "needs action." */
.ready-card.arch-form {
  background: #eff6ff;
  border-color: #93c5fd;
}
.ready-card.arch-form .meta,
.ready-card.arch-form .chart-field { color: #1e40af; }
.ready-card.arch-form .chart-fields { border-top-color: #93c5fd; }

.arch-form-tag {
  display: inline-block; font-size: 11px; font-weight: 700; color: #1e40af;
  background: #dbeafe; border-radius: 4px; padding: 2px 6px; align-self: flex-start;
  margin-right: 4px;
}

/* Every card should say which lab it's for explicitly - a card with no
   tag at all (previously how "In Office" was shown, by omission) reads
   as ambiguous rather than "this one's the default" (user's call - see
   chat). Green to match the card's own default ready-card tint. */
.in-office-tag {
  display: inline-block; font-size: 11px; font-weight: 700; color: #166534;
  background: #dcfce7; border-radius: 4px; padding: 2px 6px; align-self: flex-start;
  margin-right: 4px;
}

.printed-tag {
  display: inline-block; font-size: 11px; font-weight: 700; color: #854d0e;
  background: #fef9c3; border-radius: 4px; padding: 2px 6px; align-self: flex-start;
  margin-right: 4px;
}
.postage-tag {
  display: inline-block; font-size: 11px; font-weight: 700; color: #991b1b;
  background: #fee2e2; border-radius: 4px; padding: 2px 6px; align-self: flex-start;
}
.btn-postage:disabled {
  background: #d1d5db; border-color: #d1d5db; color: #6b7280; cursor: not-allowed;
}

/* Remove button on a live Ready-to-Print card - staff decided not to
   ship it. Deliberately understated (plain secondary gray) next to the
   colored Print/Postage buttons, since it's the "opt out" action. */
.btn-remove { margin-top: 4px; }

.removed-tag {
  display: inline-block; font-size: 11px; font-weight: 700; color: #4b5563;
  background: #e5e7eb; border-radius: 4px; padding: 2px 6px; align-self: flex-start;
}

/* Print labels - hidden on screen, shown only when printing. Each
   .label-page becomes its own separate physical label. */
#printLabels { display: none; }
#printPostage { display: none; }
@media print {
  body.printing-label > *:not(#printLabels) { display: none !important; }
  #printLabels { display: block !important; }
  .label-page {
    page: traylabel;
    width: 3in;
    height: 3in;
    box-sizing: border-box;
    padding: 0.15in;
    font-family: -apple-system, Arial, sans-serif;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .label-page:not(:last-child) { page-break-after: always; }
  .label-page .label-header-corner { position: absolute; font-size: 8px; color: #444; }
  .label-page .label-header-corner.top-left { top: 0.15in; left: 0.15in; }
  .label-page .label-header-corner.top-right { top: 0.15in; right: 0.15in; text-align: right; }
  .label-page .label-header-corner.bottom-left { bottom: 0.15in; left: 0.15in; }
  .label-page .label-header-corner.bottom-right { bottom: 0.15in; right: 0.15in; text-align: right; }
  .label-page .label-title { font-size: 13px; font-weight: 700; margin: 0 0 2px; }
  .label-page .label-line { font-size: 12px; margin: 0 0 2px; }
  .label-page .label-tray { font-size: 20px; font-weight: 700; margin: 2px 0; }
  .label-page.tray-label .label-title { font-size: 18px; margin-bottom: 2px; }
  .label-page.tray-label .label-line { font-size: 16px; margin-bottom: 2px; }
  .label-page.tray-label .label-tray { font-size: 28px; margin: 2px 0; }
  /* Appliance names run much longer than a tray number ("U1") - smaller
     and wrapped so a long name doesn't overflow the 3x3in label. */
  .label-page.tray-label .label-tray.label-appliance { font-size: 16px; white-space: normal; line-height: 1.2; }
  @page traylabel { size: 3in 3in; margin: 0; }

  /* Postage label - a plain PNG image from Shippo (not a PDF opened in
     a separate viewer), printed the same direct way as tray labels
     above: populate the hidden container, add a body class, call
     window.print(). Uses its own named page (not the 3x3in tray-label
     page) since a shipping label is a completely different physical
     size - "auto" leaves it to the printer's own page size/driver
     (e.g. a dedicated 4x6 thermal label printer) rather than assuming
     one. */
  body.printing-postage > *:not(#printPostage) { display: none !important; }
  #printPostage { display: block !important; }
  .postage-print-page {
    page: postagepage;
    width: 4in;
    margin: 0 auto;
    padding: 0;
  }
  .postage-print-page img { width: 100%; height: auto; display: block; }
  @page postagepage { size: auto; margin: 0.25in; }
}

/* Daily Ortho Status page - status checklist (checkboxes instead of a
   dropdown) and procedure-note checkboxes. */
.status-checklist { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 4px 0 8px; }
.status-check { display: flex; align-items: center; gap: 4px; font-size: 13px; cursor: pointer; }
.status-check input { margin: 0; }

/* Chair View quick-entry: OJ/OB, OH, X-rays, Behavior, Notes packed
   into 2 wrapping rows instead of one field per line - cards are only
   ~200px wide (see TIMELINE_MIN_CARD_WIDTH in chair-view.js). */
.quick-entry-row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin: 2px 0; }
/* Last visit's OJ/OB, OH and behavior, carried onto today's note unless
   somebody ticks Changed. One quiet line rather than three controls,
   because on nearly every visit there is nothing to do with them. */
.qe-carried {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin: 3px 0; font-size: 11.5px; color: inherit; opacity: .85;
}
.qe-carried-vals { flex: 1; min-width: 0; }
.qe-changed { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; cursor: pointer; }
.qe-sticky[hidden] { display: none; }
.qe-label { font-size: 11px; color: var(--muted); white-space: nowrap; }
.qe-input { font-size: 13px; padding: 2px 4px; border: 1px solid var(--border); border-radius: 4px; min-width: 0; }
.qe-input-grow { flex: 1 1 60px; }

/* A Screen/Supervision note has been entered directly in Open Dental -
   same red used elsewhere for "someone acted on this today". */
.ready-card.screen-note-entered { background: #fef2f2; border-color: #fca5a5; }
.ready-card.screen-note-entered .meta,
.ready-card.screen-note-entered .status-check { color: #991b1b; }

/* Chair View - a single row of taller, narrower cards ordered
   left-to-right by appointment time, scrollable instead of wrapping
   into a 2D grid (which breaks the time-order reading across rows).
   Own color states, independent of .ready-card: neutral by default,
   green once the patient has arrived (DateTimeArrived), red once the
   note has been published. Cancelled/broken appointments get an X
   overlay instead of a color change, mirroring Open Dental's own UI. */
.chair-timeline {
  /* align-items: flex-start (not the flex default of stretch) so a card
     with little content isn't force-stretched to match a taller card
     sharing its row - that stretching, not the old fixed min-height, was
     the real source of the leftover dead space below the Publish button
     on shorter cards (see chat). */
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 10px;
}
.np-tag {
  display: inline-block; font-size: 11px; font-weight: 700; color: #1d4ed8;
  background: #dbeafe; border-radius: 4px; padding: 1px 5px; vertical-align: middle;
}

/* Age beside the name on a Chair View card - the first thing anyone asks
   about a name they don't recognise, and in a pedo practice it changes
   what the visit is. */
.chair-card .age-tag {
  font-size: 11px; font-weight: 700; background: rgba(0,0,0,.08);
  border-radius: 999px; padding: 1px 7px; margin-left: 4px; vertical-align: middle;
}
/* OH, Behaviour and X-rays only ever take one of two values, so they are
   pressed rather than typed - quicker at the chair, and impossible to
   spell three different ways in the note. */
.qe-choice { display: inline-flex; align-items: center; gap: 2px; margin-right: 6px; }
/* Sized to hold the same two rows the text inputs did - a two-button pair
   is wider than a 40px box, so the padding is tight and the pairs are
   split across the existing rows rather than adding one. */
.qe-opt {
  font-family: inherit; font-size: 10.5px; font-weight: 600; cursor: pointer;
  padding: 2px 6px; border-radius: 5px; border: 1px solid var(--border);
  background: rgba(255,255,255,.75); color: #374151; white-space: nowrap;
}
.qe-opt:hover { border-color: var(--accent); }
.qe-opt.on { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.chair-card {
  /* 9 per row (was 5) now that main is wider - see lab-common.css main
     rule. No fixed min-height (was 360px): that left a lot of dead
     space below the Publish button on cards with less content - height
     now just follows content, and flex's default stretch still keeps
     cards even with their tallest row-mate. Room grows back naturally
     as more fields/data get added to a card later. */
  flex: 0 0 calc((100% - 80px) / 9);
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px; display: flex; flex-direction: column; gap: 6px;
  position: relative;
}
.chair-card .name { font-size: 16px; font-weight: 600; }
.chair-card .meta { font-size: 13px; color: var(--muted); }

.chair-card.published { background: #fef2f2; border-color: #fca5a5; }
.chair-card.published .meta { color: #991b1b; }
.chair-card.published .btn { background: #dc2626; border-color: #dc2626; }

.chair-card.cancelled { opacity: 0.7; }
.chair-card.cancelled::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to bottom right, transparent calc(50% - 1.5px), #dc2626 calc(50% - 1.5px), #dc2626 calc(50% + 1.5px), transparent calc(50% + 1.5px)),
    linear-gradient(to bottom left, transparent calc(50% - 1.5px), #dc2626 calc(50% - 1.5px), #dc2626 calc(50% + 1.5px), transparent calc(50% + 1.5px));
}
.cancelled-tag {
  display: inline-block; font-size: 11px; font-weight: 700; color: #991b1b;
  background: #fee2e2; border-radius: 4px; padding: 2px 6px; align-self: flex-start;
}

/* Screen/Supervision ortho reminder on Chair View - static until the
   patient's been in the room CHAIR_VIEW_ORTHO_REMINDER_MINUTES (blink-red
   class only added past that point, see chair-view.js orthoReminderHtml). */
.ortho-send-reminder { font-size: 12px; font-weight: 600; color: var(--text); margin-top: 2px; }
.ortho-send-reminder.blink-red {
  color: #dc2626;
  animation: ortho-send-blink 1s step-start infinite;
}
@keyframes ortho-send-blink {
  50% { opacity: 0; }
}

/* Procedure text is one of the noisiest things on Open Dental's own
   schedule - kept off the card by default and only revealed by
   hovering/focusing the small "Procedures" label, so it doesn't add to
   visual clutter when just glancing at the board without a mouse. */
.proc-hover {
  position: relative; display: inline-block; align-self: flex-start;
  font-size: 12px; color: var(--muted); text-decoration: underline dotted;
  cursor: default;
}
.proc-tooltip {
  display: none; position: absolute; top: 100%; left: 0; z-index: 30;
  background: #1f2430; color: #fff; padding: 6px 8px; border-radius: 6px;
  font-size: 12px; line-height: 1.4; white-space: normal;
  min-width: 160px; max-width: 260px; margin-top: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.proc-hover:hover .proc-tooltip, .proc-hover:focus .proc-tooltip { display: block; }

/* Last POE button/hover - staff need the previous visit's SOAP note
   (often ~6 months back) without it permanently taking up card space.
   Bigger and scrollable vs. the procedures tooltip since SOAP notes
   run long, but same off-by-default, hover-to-reveal pattern. */
.last-poe-hover { position: relative; display: inline-block; align-self: flex-start; }
.last-poe-btn {
  display: inline-block; font-size: 12px; font-weight: 600; color: #4338ca;
  background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 6px;
  padding: 3px 8px; cursor: default;
}
.last-poe-tooltip {
  display: none; position: absolute; top: 100%; left: 0; z-index: 40;
  background: #1f2430; color: #fff; padding: 10px 12px; border-radius: 8px;
  font-size: 12px; line-height: 1.5; white-space: pre-wrap;
  width: 340px; max-height: 320px; overflow-y: auto; margin-top: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.last-poe-hover:hover .last-poe-tooltip, .last-poe-hover:focus .last-poe-tooltip { display: block; }

/* Houses the "Procedures" hover and its Set Complete button side by
   side - the hover already lists what Set Complete would bill, so
   they read as one unit rather than stacking as separate rows. */
.proc-row { display: flex; align-items: center; gap: 8px; }

/* Single-chair timeline mode: card width and the space between cards
   are proportional to real chair time (see chat) - only enabled when
   the backend returns a "timeline" array, which only happens for one
   specific chair, not "All chairs" (see chat for why). Wraps to a new
   row like the grid mode (~5 cards per row) rather than scrolling -
   a segment that would overflow the row just starts the next line,
   same as word-wrap in a paragraph. */
.chair-timeline.timeline-mode .chair-card { flex: 0 0 auto; }
.chair-gap {
  flex: 0 0 auto; min-height: 360px; display: flex; align-items: center; justify-content: center;
  text-align: center; color: var(--muted); font-size: 11px;
  border-left: 1px dashed var(--border); border-right: 1px dashed var(--border);
}
.chair-blockout {
  flex: 0 0 auto; min-height: 360px; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 8px; font-size: 12px; color: #4b5563;
  background: repeating-linear-gradient(45deg, #f3f4f6, #f3f4f6 8px, #e5e7eb 8px, #e5e7eb 16px);
  border: 1px dashed #9ca3af; border-radius: 10px;
}

/* Chair View: answering the send-to-ortho reminder ------------------------ */
/* .btn is a filled button, so these set their own fill - overriding only the
   text colour left green-on-green. */
.ortho-handoff-actions { display: flex; gap: 6px; margin-top: 5px; }
.ortho-handoff-actions .btn { background: var(--card-bg); border-color: #9ca3af; color: var(--text); }
.ortho-handoff-actions .btn:hover { border-color: #6b7280; }
.ortho-handoff-actions .btn-sent { background: #16a34a; border-color: #16a34a; color: #fff; font-weight: 600; }
.ortho-handoff-actions .btn-sent:hover { background: #15803d; border-color: #15803d; }
.ortho-handoff-done { font-size: 12px; font-weight: 600; margin-top: 4px; display: flex;
  align-items: center; flex-wrap: wrap; gap: 4px; }
.ortho-handoff-done.went { color: #15803d; }
.ortho-handoff-done.didnt { color: #6b7280; }
.ortho-handoff-done .btn { background: var(--card-bg); border-color: var(--border); color: var(--muted); }

/* Ortho Status: who is actually walking round ---------------------------- */
/* Every card on this board is already pale green, so a green background
   says nothing. The signal is a solid ring plus a pulsing tag - new
   content moving is what catches an eye across a room, not a tint. */
/* Pink, not green: this board is pale green throughout, so green reads as
   "same as everything else" while pink is unmissable across a room. */
.ready-card.ortho-coming {
  border: 2px solid #db2777;
  box-shadow: 0 0 0 3px rgba(219, 39, 119, 0.18);
}
.ortho-coming-tag {
  display: inline-block; align-self: flex-start;
  font-size: 11px; font-weight: 800; letter-spacing: .04em;
  color: #fff; background: #db2777; border-radius: 4px; padding: 3px 8px;
  animation: ortho-coming-pulse 1.1s ease-in-out infinite;
}
@keyframes ortho-coming-pulse {
  50% { background: #f472b6; transform: scale(1.04); }
}

/* Gone home reads as settled, not urgent - it is information, not a task.
   Draining the colour out is what separates it from the live board. */
.ready-card.ortho-not-coming { border-color: #d1d5db; background: #fafafa; opacity: .75; }
.ready-card.ortho-not-coming .meta { color: var(--muted); }
.ortho-not-coming-tag {
  display: inline-block; align-self: flex-start;
  font-size: 11px; font-weight: 700; color: #4b5563;
  background: #e5e7eb; border-radius: 4px; padding: 3px 8px;
}

@media (prefers-reduced-motion: reduce) {
  .ortho-coming-tag { animation: none; }
  .ortho-send-reminder.blink-red { animation: none; text-decoration: underline; }
}

/* Selecting a patient to move into the room ------------------------------ */
/* Has to read from across a room without hiding the status colour the card
   already carries, so it is an outline rather than a fill. */
.chair-card.selected, .apt-block.selected {
  outline: 3px solid #2563eb; outline-offset: -1px;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.22);
}
.apt-block.selected { z-index: 3; }
#selectedLabel.has-selection { color: #1d4ed8; font-weight: 700; }
.toolbar-sep { width: 1px; height: 22px; background: var(--border); display: inline-block; }

/* Arch Form / tray cards -------------------------------------------------
   Shared so the lab page and the patient card show the same thing the same
   way - a tray set is a tray set wherever it appears, and two renderings
   would drift. Red means shipped: it is the state that needs somebody to
   do something (tell the family, expect the delivery), not an error. */
.af-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 12px; }
.af-card {
  border: 1px solid var(--border); border-radius: 10px; background: var(--card-bg);
  padding: 12px 14px; display: flex; flex-direction: column; gap: 6px;
}
.af-card.shipped { border: 2px solid #dc2626; background: #fef2f2; }
.af-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.af-name { font-size: 15px; font-weight: 700; }
.af-state {
  font-size: 10.5px; font-weight: 800; letter-spacing: .04em; border-radius: 4px;
  padding: 2px 7px; background: #e5e7eb; color: #4b5563; white-space: nowrap;
}
.af-card.shipped .af-state { background: #dc2626; color: #fff; }
.af-line { font-size: 13px; color: var(--muted); line-height: 1.45; }
.af-card.shipped .af-line { color: #7f1d1d; }
.af-track {
  font-family: ui-monospace, Menlo, monospace; font-size: 12px;
  word-break: break-all; color: #991b1b;
}
.af-track a { color: #991b1b; }
.af-empty { font-size: 13px; color: var(--muted); }

/* A retainer takes its LAB's colour, one step darker - and goes red the
   moment money is owed (user's call, 2026-09-08).

   That is the whole rule, and it is two facts on one card: which bench
   the case belongs to, and whether anyone still owes for it. Darker
   green is the office's own retainer; darker blue is Arch Form's. Red
   means stop, whichever bench it came from, because sending a case out
   with the balance still open is the mistake this colour exists to
   prevent.

   It replaces amber, which said neither thing - it was a fourth hue that
   meant only "this is a retainer", on a board where colour already meant
   where the work was. Amber also hid two collisions: paid was EXACTLY
   the default card's green, and sent was EXACTLY Arch Form's blue.

   Red is shared with postage-printed. The two can never land on one card
   (postage wins the class outright - see cardClass), and they say
   compatible things anyway. */

/* Settled, on the office's own bench: the default card's green, darker. */
.ready-card.retainer {
  background: #bbf7d0;
  border-color: #16a34a;
}
.ready-card.retainer .meta,
.ready-card.retainer .chart-field { color: #14532d; }
.ready-card.retainer .chart-fields { border-top-color: #16a34a; }

/* Settled, at Arch Form: their blue, darker. */
.ready-card.arch-form.retainer {
  background: #bfdbfe;
  border-color: #2563eb;
}
.ready-card.arch-form.retainer .meta,
.ready-card.arch-form.retainer .chart-field { color: #1e3a8a; }
.ready-card.arch-form.retainer .chart-fields { border-top-color: #2563eb; }

/* Owed. Open (nothing sent) and sent (waiting on the patient) are both
   unpaid, so both stop - what is left to do is on the tag, not in the
   colour.

   Every combination is spelled out rather than leaning on source order:
   the Arch Form rule above carries identical specificity, and "whichever
   came last in the file" is not something to hang a stop signal on. */
.ready-card.retainer.retainer-open,
.ready-card.retainer.retainer-sent,
.ready-card.arch-form.retainer.retainer-open,
.ready-card.arch-form.retainer.retainer-sent {
  background: #fee2e2;
  border-color: #ef4444;
}
.ready-card.retainer.retainer-open .meta,
.ready-card.retainer.retainer-open .chart-field,
.ready-card.retainer.retainer-sent .meta,
.ready-card.retainer.retainer-sent .chart-field,
.ready-card.arch-form.retainer.retainer-open .meta,
.ready-card.arch-form.retainer.retainer-open .chart-field,
.ready-card.arch-form.retainer.retainer-sent .meta,
.ready-card.arch-form.retainer.retainer-sent .chart-field { color: #7f1d1d; }
.ready-card.retainer.retainer-open .chart-fields,
.ready-card.retainer.retainer-sent .chart-fields,
.ready-card.arch-form.retainer.retainer-open .chart-fields,
.ready-card.arch-form.retainer.retainer-sent .chart-fields { border-top-color: #ef4444; }

.retainer-tag {
  display: inline-block; font-size: 11px; font-weight: 700; color: #7f1d1d;
  background: #fecaca; border-radius: 4px; padding: 2px 6px; align-self: flex-start;
  margin-right: 4px;
}

.retainer-pay {
  display: flex; flex-direction: column; gap: 6px;
  margin-top: 8px; padding-top: 8px; border-top: 1px solid #ef4444;
}
.retainer-pay label { display: flex; align-items: center; gap: 4px; color: #7f1d1d; }
.retainer-amount {
  width: 90px; padding: 4px 6px; font-size: 13px;
  border: 1px solid #ef4444; border-radius: 4px; background: #fff;
}

.retainer-tag-sent { background: #fecaca; color: #991b1b; }
.retainer-tag-paid { background: #86efac; color: #14532d; }

/* Replaces the amount box and send button once there is nothing to send.
   A statement of fact, not a disabled control - a greyed-out button
   invites a click and then explains itself, which is worse. */
.retainer-settled {
  font-size: 12px; font-weight: 600; border-radius: 6px;
  padding: 5px 8px; margin-top: 2px;
}
.retainer-settled.paid { background: #86efac; color: #14532d; }
.retainer-settled.sent { background: #fecaca; color: #991b1b; }
.retainer-settled .sub { font-weight: 500; opacity: .85; }

/* A waived retainer has no balance, so it is not red - it takes the
   lab's darker shade like any other settled one, and the tag is what
   says nobody was charged. It kept a slate of its own while paid was
   green-for-money; now that the colour means the bench rather than the
   revenue, a separate grey would only say "some other kind of card",
   which it is not. */
.retainer-tag-no_charge { background: #e2e8f0; color: #475569; }
/* The word that decides whether anyone has to do something about this
   card, so it reads at the same glance the tag does. */
.retainer-paid-yes { color: #14532d; }
.retainer-paid-no { color: #b91c1c; }
.retainer-settled.no-charge { background: #e2e8f0; color: #475569; }
.retainer-undo { margin-left: 8px; vertical-align: middle; }

/* The "Both parents" box in a page toolbar - see pageBothParents(). */
.both-parents-box {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px;
  font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap;
}

/* Open Dental's own lab case, cross-referenced on each card (2026-09-10).
   A quiet line - deliveries are checked in Open Dental, this only says
   what it has. */
.ready-card .od-lab { font-size: 12px; }
.ready-card .od-lab-none { color: #9ca3af; }
.ready-card .od-lab-back { color: #047857; font-weight: 600; }
.ready-card .od-lab-out { color: #92400e; }
.ready-card .od-lab-late { color: #b91c1c; font-weight: 600; }
