/* Patient Print Workbench — dense find + hub + print products */

/* ── Workbench shell ──────────────────────────────────────────── */

.ppc-workbench,
.ppc-workspace {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 24px;
}

.ppc-workbench .eu-page-header,
.ppc-workspace__search .eu-page-header {
  margin-bottom: 4px;
}

.ppc-workbench .eu-search-page__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Scan field emphasis (dense adaptive grid otherwise from PEUF) */
.ppc-search-compact__scan .eu-label {
  color: var(--eu-accent, #0f766e);
}

.ppc-search-compact__scan-input {
  border-color: color-mix(in srgb, var(--eu-accent, #0f766e) 45%, #cbd5e1);
  background: color-mix(in srgb, var(--eu-accent, #0f766e) 6%, #fff);
}

/* ── Results + empty / idle ───────────────────────────────────── */

.ppc-results__row--selected {
  background: color-mix(in srgb, var(--eu-accent, #0f766e) 8%, #fff);
}

.ppc-results__empty,
.ppc-results__idle .eu-empty {
  padding: 24px 16px 28px;
}

/* ── Selected patient hub ─────────────────────────────────────── */

.ppc-hub {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  padding: 14px 16px 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.ppc-hub__patient {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 12px;
}

.ppc-hub__uhid {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--eu-accent, #0f766e);
  text-transform: uppercase;
}

.ppc-hub__name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
}

.ppc-hub__meta {
  margin-top: 2px;
  font-size: 0.8125rem;
  color: #64748b;
}

.ppc-hub__status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.ppc-hub__badge {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #0f766e;
  background: #ccfbf1;
}

.ppc-hub__actions-title {
  margin: 0 0 10px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ppc-hub__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.ppc-hub__tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.ppc-hub__tile:hover {
  border-color: #99f6e4;
  background: #fff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.ppc-hub__tile--primary {
  border-color: color-mix(in srgb, var(--eu-accent, #0f766e) 35%, #e2e8f0);
  background: color-mix(in srgb, var(--eu-accent, #0f766e) 8%, #fff);
}

.ppc-hub__tile--disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ppc-hub__tile-label {
  font-size: 0.875rem;
  font-weight: 700;
  color: #0f172a;
}

.ppc-hub__tile-hint {
  font-size: 0.72rem;
  color: #64748b;
  line-height: 1.35;
}

.ppc-hub__recent {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}

.ppc-hub__recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ppc-hub__recent-link {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  font-size: 0.75rem;
  font-weight: 600;
  color: #334155;
  text-decoration: none;
  background: #fff;
}

.ppc-hub__recent-link:hover {
  border-color: #99f6e4;
  color: #0f766e;
}

.ppc-preview-panel {
  padding: 0;
}

/* ── Visit slip ───────────────────────────────────────────────── */

.ppc-slip-page {
  padding: 16px;
}

.ppc-slip {
  max-width: 420px;
  margin: 0 auto;
  padding: 18px 20px;
  border: 1px solid #0f172a;
  background: #fff;
}

.ppc-slip__hospital {
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
}

.ppc-slip__title {
  margin: 6px 0 14px;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #475569;
}

.ppc-slip__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
}

.ppc-slip__label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.ppc-slip__value {
  font-size: 0.875rem;
  color: #0f172a;
}

.ppc-slip__value--strong {
  font-weight: 700;
  font-size: 1rem;
}

.ppc-slip__qr {
  margin-top: 14px;
  text-align: center;
}

.ppc-slip__footer {
  margin-top: 10px;
  font-size: 0.7rem;
  text-align: center;
  color: #64748b;
}

.ppc-consent-label__tag {
  display: inline-block;
  margin-bottom: 4px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #9a3412;
  background: #ffedd5;
  border: 1px solid #fdba74;
}

/* ── ID card preview + options ────────────────────────────────── */

.ppc-preview {
  max-width: 760px;
}

.ppc-preview__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 14px;
}

.ppc-preview__titles {
  flex: 1 1 180px;
  min-width: 0;
}

.ppc-preview__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--eu-text, #0f172a);
}

.ppc-preview__subtitle {
  margin: 2px 0 0;
  font-size: 0.8125rem;
  color: var(--eu-text-muted, #64748b);
}

.ppc-preview__options {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

.ppc-preview__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
}

.ppc-preview__field .eu-input,
.ppc-preview__field select {
  min-width: 140px;
  font-weight: 500;
}

.ppc-card {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 16px 20px;
  align-items: start;
  padding: 18px 20px;
  border: 1px solid #0f172a;
  background: #fff;
  color: #0f172a;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.ppc-preview[data-paper="cr80"] .ppc-card {
  max-width: 86mm;
}

.ppc-card__photo {
  width: 110px;
  height: 130px;
  border: 1px solid #94a3b8;
  background: #e2e8f0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ppc-card__photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ppc-card__photo-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #cbd5e1 0%, #94a3b8 100%);
}

.ppc-card__photo-initials {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #f8fafc;
}

.ppc-card__fields {
  margin: 0;
}

.ppc-card__row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 6px 10px;
  margin: 0 0 6px;
  font-size: 0.875rem;
  line-height: 1.35;
}

.ppc-card__row dt {
  margin: 0;
  font-weight: 600;
  color: #334155;
}

.ppc-card__row dd {
  margin: 0;
  font-weight: 700;
  color: #0f172a;
  word-break: break-word;
}

.ppc-card__row dd::before {
  content: ": ";
  font-weight: 600;
  color: #64748b;
  margin-right: 2px;
}

.ppc-card__instruction {
  margin: 12px 0 0;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #0f172a;
  line-height: 1.35;
}

.ppc-card__qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 110px;
}

.ppc-card__qr svg {
  width: 110px;
  height: 110px;
  display: block;
}

.ppc-card__qr-caption {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #475569;
  text-align: center;
  max-width: 120px;
  word-break: break-all;
}

/* ── OP Labels (A4, 3 columns) ────────────────────────────────── */

.ppc-op-page {
  padding: 16px;
}

.ppc-op-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}

.ppc-op-toolbar__titles {
  flex: 1 1 200px;
  min-width: 0;
}

.ppc-op-toolbar__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.ppc-op-toolbar__subtitle {
  margin: 2px 0 0;
  font-size: 0.8125rem;
  color: #64748b;
}

.ppc-op-toolbar__form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

.ppc-op-sheet {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3mm;
}

.ppc-op-label {
  display: grid;
  grid-template-columns: 1fr 52px;
  gap: 4px;
  align-items: center;
  min-height: 32mm;
  padding: 3mm 3.5mm;
  border: 1px dashed #94a3b8;
  background: #fff;
  color: #0f172a;
  break-inside: avoid;
  page-break-inside: avoid;
}

.ppc-op-label__uhid {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  font-weight: 800;
}

.ppc-op-label__name {
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
}

.ppc-op-label__meta {
  font-size: 0.65rem;
  color: #334155;
  line-height: 1.25;
}

.ppc-op-label__qr {
  display: flex;
  justify-content: center;
}

.ppc-op-label__qr svg {
  width: 48px;
  height: 48px;
}

/* ── Patient barcode printer labels ───────────────────────────── */

.ppc-bc-page {
  padding: 16px;
}

.ppc-bc-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}

.ppc-bc-toolbar__titles {
  flex: 1 1 200px;
  min-width: 0;
}

.ppc-bc-toolbar__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.ppc-bc-toolbar__subtitle {
  margin: 2px 0 0;
  font-size: 0.8125rem;
  color: #64748b;
}

.ppc-bc-toolbar__form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

.ppc-bc-sheet {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ppc-bc-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 3mm;
  border: 1px dashed #94a3b8;
  background: #fff;
  color: #0f172a;
  break-inside: avoid;
  page-break-inside: avoid;
  box-sizing: border-box;
}

.ppc-bc-sheet--50x25 .ppc-bc-label { width: 50mm; height: 25mm; }
.ppc-bc-sheet--40x30 .ppc-bc-label { width: 40mm; height: 30mm; }
.ppc-bc-sheet--58x40 .ppc-bc-label { width: 58mm; height: 40mm; }
.ppc-bc-sheet--80x50 .ppc-bc-label { width: 80mm; height: 50mm; }

.ppc-bc-label__meta {
  width: 100%;
  text-align: center;
  line-height: 1.15;
}

.ppc-bc-label__uhid {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.7rem;
  font-weight: 800;
}

.ppc-bc-label__name {
  font-size: 0.62rem;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ppc-bc-label__age {
  font-size: 0.58rem;
  color: #475569;
}

.ppc-bc-label__symbol {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex: 1;
}

.ppc-bc-label__img {
  max-width: 100%;
  height: auto;
  display: block;
  image-rendering: pixelated;
}

.ppc-bc-label__img--code128,
.ppc-bc-label__img--code39 {
  max-height: 14mm;
  width: 100%;
  object-fit: contain;
}

.ppc-bc-label__img--qr,
.ppc-bc-label__img--datamatrix {
  max-height: 22mm;
  max-width: 22mm;
}

.ppc-bc-label__caption {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.ppc-bc-label__error {
  margin: 0;
  font-size: 0.65rem;
  color: #b91c1c;
}

/* ── MRD file label (EMR_3) ─────────────────────────────────── */

.mfl-page {
  padding: 16px;
}

.mfl-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}

.mfl-toolbar__titles {
  flex: 1 1 220px;
  min-width: 0;
}

.mfl-toolbar__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.mfl-toolbar__subtitle {
  margin: 2px 0 0;
  font-size: 0.8125rem;
  color: #64748b;
}

.mfl-toolbar__form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

.mfl-toolbar__hint {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.75rem;
  color: #64748b;
}

.mfl-sheet {
  display: flex;
  flex-wrap: wrap;
  gap: 4mm;
}

.mfl-label {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: 1.5mm;
  border: 0.2mm solid #cbd5e1;
  overflow: hidden;
  font-family: system-ui, sans-serif;
  background: #fff;
}

.mfl-sheet--50x25 .mfl-label { width: 50mm; height: 25mm; }
.mfl-sheet--40x30 .mfl-label { width: 40mm; height: 30mm; }
.mfl-sheet--58x40 .mfl-label { width: 58mm; height: 40mm; }
.mfl-sheet--80x50 .mfl-label { width: 80mm; height: 50mm; }

.mfl-label__head {
  display: flex;
  justify-content: space-between;
  gap: 2mm;
  font-size: 0.55rem;
  font-weight: 700;
  line-height: 1.1;
}

.mfl-label__hospital {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mfl-label__uhid {
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

.mfl-label__meta {
  flex: 0 0 auto;
  font-size: 0.5rem;
  line-height: 1.15;
}

.mfl-label__name {
  font-weight: 600;
  margin-bottom: 0.5mm;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mfl-label__line {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mfl-label__symbol {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.mfl-label__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.mfl-label__img--code128,
.mfl-label__img--code39 {
  width: 100%;
  height: auto;
}

.mfl-label__img--qr,
.mfl-label__img--datamatrix {
  width: auto;
  height: 100%;
}

.mfl-label__caption {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.48rem;
  font-weight: 600;
  text-align: center;
}

.mfl-label__error {
  margin: 0;
  font-size: 0.55rem;
  color: #b91c1c;
}

/* ── Wrist band (FO + future IP) ──────────────────────────────── */

.ppc-wb-page {
  padding: 16px;
}

.ppc-wb-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}

.ppc-wb-toolbar__titles {
  flex: 1 1 220px;
  min-width: 0;
}

.ppc-wb-toolbar__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.ppc-wb-toolbar__subtitle {
  margin: 2px 0 0;
  font-size: 0.8125rem;
  color: #64748b;
}

.ppc-wb-toolbar__form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

.ppc-wb-sheet {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ppc-wb-band {
  width: var(--wb-w, 280mm);
  height: var(--wb-h, 25mm);
  max-width: 100%;
  box-sizing: border-box;
  padding: 1.5mm 3mm;
  border: 1px solid #0f172a;
  background: #fff;
  color: #0f172a;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1mm;
  break-inside: avoid;
  page-break-inside: avoid;
}

.ppc-wb-band--ip {
  border-width: 2px;
  border-color: #b45309;
}

.ppc-wb-band__hospital {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #475569;
}

.ppc-wb-band__body {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4mm;
  align-items: center;
}

.ppc-wb-band__uhid {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  font-weight: 800;
}

.ppc-wb-band__name {
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.15;
}

.ppc-wb-band__meta,
.ppc-wb-band__ward,
.ppc-wb-band__ctx {
  font-size: 0.58rem;
  line-height: 1.2;
  color: #334155;
}

.ppc-wb-band__ctx {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.ppc-wb-band__symbol {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.ppc-wb-band__img--code128 {
  height: 10mm;
  max-width: 55mm;
  object-fit: contain;
}

.ppc-wb-band__img--qr {
  height: 16mm;
  width: 16mm;
  object-fit: contain;
}

.ppc-wb-band__caption {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.5rem;
  font-weight: 600;
}

.ppc-wb-hint {
  margin-top: 12px;
  font-size: 0.8125rem;
  color: #64748b;
  max-width: 640px;
}

@media (max-width: 640px) {
  .ppc-card {
    grid-template-columns: 90px 1fr;
  }

  .ppc-card__qr {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: flex-start;
  }

  .ppc-op-sheet {
    grid-template-columns: 1fr;
  }
}

/* ── Print ────────────────────────────────────────────────────── */

@media print {
  body * {
    visibility: hidden;
  }

  .ppc-card,
  .ppc-card *,
  .ppc-op-sheet,
  .ppc-op-sheet *,
  .ppc-bc-sheet,
  .mfl-sheet,
  .ppc-bc-sheet *,
  .mfl-sheet *,
  .ppc-wb-sheet,
  .ppc-wb-sheet *,
  .ppc-slip,
  .ppc-slip * {
    visibility: visible;
  }

  .ppc-card,
  .ppc-slip {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    max-width: none;
    box-shadow: none;
  }

  .ppc-op-sheet,
  .ppc-bc-sheet,
  .mfl-sheet,
  .ppc-wb-sheet {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }

  .ppc-op-label,
  .ppc-bc-label,
  .mfl-label,
  .ppc-wb-band {
    border-style: solid;
  }

  .ppc-workbench__search,
  .ppc-workbench__hub,
  .ppc-workbench__results,
  .ppc-workspace__search,
  .ppc-preview__toolbar,
  .ppc-op-toolbar,
  .ppc-bc-toolbar,
  .mfl-toolbar,
  .ppc-wb-toolbar,
  .ppc-wb-hint,
  .app-shell__sidebar,
  .app-sidebar,
  .app-shell__topbar,
  .app-topbar,
  .eu-request-timing,
  .ai-chat-widget,
  #page-loader {
    display: none !important;
  }
}
