/* Staff order queue.
 *
 * Every colour is a token from the shared palette (tokens.css / styles.css).
 * Nothing here introduces a new one: a second teal that is almost the first
 * teal is how a design system dies.
 *
 * The queue is scanned, not read. So state is encoded in shape as well as in
 * words — a chip that differs by tone, a reference in tabular figures, totals
 * that line up down a column — and the row a person needs to act on should be
 * findable without reading any of it closely.
 */

.pharm-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4, 16px);
  margin-bottom: var(--s-4, 16px);
}
.pharm-head-row .muted { margin: 2px 0 0; }

.pharm-scope { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pharm-seg {
  font: inherit;
  font-size: .86rem;
  padding: 7px 14px;
  border-radius: var(--r-pill, 999px);
  border: 1px solid var(--line, #d8d2c0);
  background: var(--card, #fff);
  color: var(--ink, #10243d);
  cursor: pointer;
}
.pharm-seg.is-on {
  background: var(--brand, #0f6d65);
  border-color: var(--brand, #0f6d65);
  color: #fff;
  font-weight: 600;
}

/* The count strip. Read at a glance before anything else on the screen. */
.pharm-counts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4, 16px);
  padding: 12px 16px;
  margin-bottom: var(--s-4, 16px);
  border: 1px solid var(--line, #d8d2c0);
  border-radius: var(--r-md, 8px);
  background: var(--card-sunken, #f2efe6);
  font-size: .85rem;
  color: var(--muted, #6b7c90);
}
.pharm-count b {
  font-variant-numeric: tabular-nums;
  font-size: 1.05rem;
  color: var(--ink, #10243d);
  margin-inline-end: 4px;
}

.pharm-list { display: grid; gap: 10px; }

.pharm-order {
  border: 1px solid var(--line, #d8d2c0);
  border-radius: var(--r-md, 8px);
  background: var(--card, #fff);
  overflow: hidden;
}
.pharm-order.is-open { border-color: var(--brand, #0f6d65); }

.pharm-head {
  display: grid;
  grid-template-columns: 9ch auto 1fr auto;
  align-items: center;
  gap: var(--s-3, 12px);
  width: 100%;
  padding: 13px 16px;
  border: 0;
  background: none;
  font: inherit;
  text-align: start;
  cursor: pointer;
  color: inherit;
}
.pharm-head:hover { background: var(--card-sunken, #f2efe6); }
.pharm-ref {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}
.pharm-where {
  color: var(--muted, #6b7c90);
  font-size: .88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pharm-num { font-variant-numeric: tabular-nums; white-space: nowrap; }

.pharm-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-pill, 999px);
  font-size: .73rem;
  font-weight: 700;
  letter-spacing: .015em;
  white-space: nowrap;
}
.pharm-ok    { background: var(--ok-soft, #dcece2);   color: var(--brand-ink, #0a4f49); }
.pharm-info  { background: var(--info-soft, #dde8f3); color: var(--info, #1f5f96); }
.pharm-warn  { background: var(--warn-soft, #f4ead0); color: var(--warn, #8a6212); }
.pharm-muted { background: var(--card-sunken, #f2efe6); color: var(--muted, #6b7c90); }

.pharm-body {
  padding: 4px 16px 18px;
  border-top: 1px solid var(--line, #d8d2c0);
}
.pharm-body h4 {
  font-size: .72rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted, #6b7c90);
  margin: 16px 0 6px;
}
.pharm-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-4, 16px);
}
.pharm-body p { margin: 0 0 4px; }
.pharm-sub { font-size: .86rem; color: var(--muted, #6b7c90); }

.pharm-items, .pharm-events {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  font-size: .89rem;
}
.pharm-items li {
  display: flex;
  justify-content: space-between;
  gap: var(--s-3, 12px);
}
.pharm-rx {
  font-size: .7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--r-pill, 999px);
  background: var(--warn-soft, #f4ead0);
  color: var(--warn, #8a6212);
}

.pharm-totals { display: grid; gap: 4px; margin: 12px 0 0; font-size: .89rem; }
.pharm-totals > div { display: flex; justify-content: space-between; gap: 12px; }
.pharm-totals dt, .pharm-totals dd { margin: 0; }
.pharm-totals dd { font-variant-numeric: tabular-nums; }
.pharm-totals .pharm-total {
  padding-top: 6px;
  margin-top: 2px;
  border-top: 1px solid var(--line, #d8d2c0);
  font-weight: 700;
}

/* History reads oldest-first, so the newest line sits nearest the buttons that
   will add the next one. */
.pharm-events li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px var(--s-3, 12px);
  padding-inline-start: 12px;
  border-inline-start: 2px solid var(--line, #d8d2c0);
}
.pharm-when { color: var(--muted, #6b7c90); font-size: .82rem; white-space: nowrap; }
.pharm-reason {
  grid-column: 1 / -1;
  color: var(--muted, #6b7c90);
  font-size: .84rem;
  font-style: italic;
}

.pharm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line, #d8d2c0);
}
.pharm-reason-input {
  flex: 1 1 220px;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--line, #d8d2c0);
  border-radius: var(--r-sm, 6px);
  background: var(--card, #fff);
  color: var(--ink, #10243d);
  font: inherit;
  font-size: .88rem;
}
/* Cancelling and refunding are the two that cannot be undone from here, so
   they never wear the primary colour. */
.pharm-danger { color: var(--danger, #b3402c); }

@media (min-width: 720px) {
  .pharm-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .pharm-head { grid-template-columns: 9ch 1fr; row-gap: 6px; }
  .pharm-where { grid-column: 1 / -1; }
  .pharm-num { grid-column: 2; text-align: end; }
}

/* --- Home visits ----------------------------------------------------------
   Above the orders, and visually lighter: a visit card is read in a hurry by
   somebody about to leave the building, so the arrival time leads and the
   address is the largest thing under it. */

#visits-panel { margin-bottom: var(--s-6, 28px); }
#visits-panel + #orders-panel { padding-top: var(--s-5, 20px); border-top: 1px solid var(--line, #d8d2c0); }

.pharm-visits { display: grid; gap: 10px; }

.pharm-visit {
  border: 1px solid var(--line, #d8d2c0);
  border-inline-start: 3px solid var(--brand, #0f6d65);
  border-radius: var(--r-md, 8px);
  background: var(--card, #fff);
  padding: 14px 16px;
}

.pharm-visit-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3, 12px);
  margin-bottom: 6px;
}
.pharm-visit-when {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pharm-visit-pet { color: var(--muted, #6b7c90); font-size: .89rem; }

.pharm-visit-where { margin: 0 0 4px; font-size: .95rem; }
.pharm-visit .pharm-sub { margin: 0 0 3px; }

.pharm-visit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line, #d8d2c0);
}
