/* ==========================================================================
   SANJARMedi — Pathology / Diagnostics Panel
   An accent variant of the shared provider design system. It inherits every
   component, token and animation from hospital.css and re-points only the
   brand hue to a diagnostics teal, so the two panels stay structurally
   identical while remaining tellable apart at a glance.
   ========================================================================== */

@import url("../../hospital/assets/hospital.css");

:root {
  /* Diagnostics teal replaces the clinical blue. Fills and ink are stepped
     separately so type on a tint keeps its contrast. */
  --sm-primary: hsl(184, 78%, 34%);
  --sm-primary-hover: hsl(184, 80%, 28%);
  --sm-primary-dark: hsl(184, 82%, 23%);
  --sm-primary-light: hsl(184, 62%, 95%);

  --sm-accent: hsl(215, 90%, 52%);
  --sm-accent-light: hsl(215, 90%, 96%);

  --sm-soft: hsl(184, 62%, 95%);
  --bs-focus-ring-color: hsla(184, 78%, 34%, 0.2);
}

/* Brand and avatar gradients follow the teal. */
.brand-mark,
.brand-icon,
.patient-avatar,
.scope-avatar,
.sidebar-user-avatar {
  background: linear-gradient(135deg, hsl(184, 78%, 36%) 0%, hsl(196, 80%, 40%) 100%);
}

.login-shell {
  background:
    radial-gradient(900px circle at 50% -10%, hsl(184, 62%, 92%), transparent 70%),
    var(--sm-bg);
}

.provider-command-strip {
  background:
    radial-gradient(600px circle at 100% 0%, rgba(255, 255, 255, 0.16), transparent 60%),
    linear-gradient(135deg, hsl(184, 78%, 34%) 0%, hsl(196, 82%, 30%) 100%);
}

.provider-command-strip .btn-primary {
  --bs-btn-color: hsl(184, 82%, 26%);
  --bs-btn-hover-color: hsl(184, 82%, 20%);
  --bs-btn-hover-bg: hsl(184, 62%, 96%);
  --bs-btn-hover-border-color: hsl(184, 62%, 96%);
  --bs-btn-active-color: hsl(184, 82%, 20%);
  --bs-btn-active-bg: hsl(184, 62%, 93%);
  --bs-btn-active-border-color: hsl(184, 62%, 93%);
}

.provider-command-strip .btn-outline-primary,
.provider-command-strip .btn-outline-secondary {
  --bs-btn-hover-color: hsl(184, 82%, 26%);
  --bs-btn-active-color: hsl(184, 82%, 20%);
}

.btn-outline-primary {
  --bs-btn-border-color: hsl(184, 50%, 80%);
}

.form-control:focus,
.form-select:focus {
  box-shadow: 0 0 0 3px hsla(184, 78%, 34%, 0.16);
}

.stat-card::before,
.stat-blue::before { background: var(--sm-primary); }

.stat-blue .stat-icon {
  color: var(--sm-primary);
  background: var(--sm-primary-light);
}

.rx-ledger-mark {
  color: var(--sm-primary);
  background: var(--sm-primary-light);
  border-color: hsl(184, 50%, 86%);
}

/* ==========================================================================
   Sample journey — a stage funnel, not a part-to-whole split
   Nine ordered stages is too many for distinguishable stacked segments, so
   each stage gets its own bar and the comparison stays about magnitude.
   One hue throughout: bar length is the encoding, colour is not.
   ========================================================================== */

.funnel-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 14px;
}

.funnel-head strong {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.funnel-head span {
  color: var(--sm-muted);
  font-size: 0.84rem;
}

.funnel-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.funnel-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.funnel-step {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  color: var(--sm-muted);
  background: var(--sm-panel-strong);
  border-radius: 50%;
  font-size: 0.66rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.funnel-row.has-value .funnel-step {
  color: #fff;
  background: var(--sm-primary);
}

.funnel-body {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.funnel-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.funnel-label {
  overflow: hidden;
  color: var(--sm-ink-soft);
  font-size: 0.82rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.funnel-row.has-value .funnel-label {
  color: var(--sm-ink);
  font-weight: 700;
}

.funnel-count {
  color: var(--sm-ink);
  font-size: 0.86rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.funnel-row:not(.has-value) .funnel-count {
  color: var(--sm-muted);
  font-weight: 600;
}

.funnel-track {
  height: 8px;
  border-radius: var(--sm-radius-pill);
  background: var(--sm-panel-strong);
  overflow: hidden;
}

.funnel-fill {
  display: block;
  height: 100%;
  border-radius: var(--sm-radius-pill);
  background: linear-gradient(90deg, hsl(184, 78%, 40%), hsl(196, 80%, 44%));
  transform-origin: left;
  animation: sm-grow-x 700ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.funnel-list li:nth-child(1) .funnel-fill { animation-delay: 60ms; }
.funnel-list li:nth-child(2) .funnel-fill { animation-delay: 105ms; }
.funnel-list li:nth-child(3) .funnel-fill { animation-delay: 150ms; }
.funnel-list li:nth-child(4) .funnel-fill { animation-delay: 195ms; }
.funnel-list li:nth-child(5) .funnel-fill { animation-delay: 240ms; }
.funnel-list li:nth-child(6) .funnel-fill { animation-delay: 285ms; }
.funnel-list li:nth-child(7) .funnel-fill { animation-delay: 330ms; }
.funnel-list li:nth-child(8) .funnel-fill { animation-delay: 375ms; }
.funnel-list li:nth-child(9) .funnel-fill { animation-delay: 420ms; }

.funnel-list li {
  animation: sm-fade-up 380ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.funnel-list li:nth-child(n+2) { animation-delay: 60ms; }
.funnel-list li:nth-child(n+4) { animation-delay: 120ms; }
.funnel-list li:nth-child(n+6) { animation-delay: 180ms; }

/* Cancelled sits outside the happy path, so it is separated and de-emphasised. */
.funnel-row.is-terminal {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px dashed var(--sm-border-light);
}

.funnel-row.is-terminal .funnel-fill {
  background: linear-gradient(90deg, hsl(354, 60%, 48%), hsl(354, 62%, 54%));
}

.funnel-row.is-terminal.has-value .funnel-step {
  background: hsl(354, 62%, 46%);
}

@media (prefers-reduced-motion: reduce) {
  .funnel-list li,
  .funnel-fill {
    animation: none !important;
  }
}

/* ==========================================================================
   Booking cards
   Mirrors the hospital panel's appointment board so the two workspaces share
   one reading pattern.
   ========================================================================== */

.booking-board {
  display: grid;
  gap: 12px;
}

.booking-board-compact {
  gap: 10px;
}

.booking-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  overflow: hidden;
  background: var(--sm-panel);
  border: 1px solid var(--sm-border-light);
  border-radius: var(--sm-radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast),
    border-color var(--transition-fast);
}

.booking-card:hover {
  transform: translateY(-2px);
  border-color: hsl(184, 50%, 82%);
  box-shadow: var(--shadow-md);
}

.booking-date-ribbon {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  padding: 14px 10px;
  color: #fff;
  background: var(--sm-ink);
  text-align: center;
}

.booking-pending-payment .booking-date-ribbon { background: hsl(35, 88%, 44%); }
.booking-paid-awaiting-assignment .booking-date-ribbon,
.booking-paid-awaiting-visit .booking-date-ribbon { background: var(--sm-primary); }
.booking-phlebotomist-assigned .booking-date-ribbon,
.booking-sample-collected .booking-date-ribbon,
.booking-sample-received-at-lab .booking-date-ribbon,
.booking-processing .booking-date-ribbon { background: hsl(196, 80%, 34%); }
.booking-completed-report-ready .booking-date-ribbon { background: hsl(150, 70%, 30%); }
.booking-cancelled .booking-date-ribbon { background: var(--sm-danger); }

.booking-date-ribbon span {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.booking-date-ribbon strong {
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.booking-card-main {
  display: grid;
  gap: 12px;
  padding: 16px;
  min-width: 0;
}

.booking-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.booking-meta-grid > div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 10px 12px;
  background: var(--sm-panel-strong);
  border: 1px solid var(--sm-border-light);
  border-radius: var(--sm-radius-sm);
}

.booking-meta-grid span {
  color: var(--sm-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.booking-meta-grid strong {
  overflow: hidden;
  color: var(--sm-ink);
  font-size: 0.88rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.booking-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.booking-actions {
  display: grid;
  justify-items: end;
  gap: 7px;
  min-width: min(100%, 320px);
}

.booking-action-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

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

  .booking-date-ribbon {
    grid-template-columns: auto 1fr;
    justify-items: start;
    text-align: left;
  }

  .booking-meta-grid {
    grid-template-columns: 1fr;
  }

  .booking-card-footer,
  .booking-actions,
  .booking-action-row {
    justify-content: stretch;
    justify-items: stretch;
  }

  .booking-action-row .btn,
  .booking-actions .btn {
    width: 100%;
  }
}

/* Pathology-specific booking stages need their own badge tints; without these
   they fell through to an untinted default and read as plain text. */
.status-paid_awaiting_assignment,
.status-paid_awaiting_visit,
.status-phlebotomist_assigned {
  color: hsl(215, 90%, 34%);
  background: hsl(215, 90%, 95%);
}

.status-sample_collected,
.status-sample_received_at_lab,
.status-processing {
  color: hsl(196, 82%, 26%);
  background: hsl(190, 70%, 94%);
}

.status-completed_report_ready {
  color: hsl(150, 75%, 24%);
  background: hsl(150, 62%, 93%);
}

.status-refunded {
  color: hsl(275, 55%, 38%);
  background: hsl(275, 60%, 96%);
}

/* Helper text under a picker, and a multi-select sized to be usable. */
.field-hint {
  color: var(--sm-muted);
  font-size: 0.74rem;
  font-weight: 500;
}

.picker-multi {
  min-height: 116px;
  padding: 6px;
}

.picker-multi option {
  padding: 5px 8px;
  border-radius: var(--sm-radius-xs);
}

.field select[disabled] {
  color: var(--sm-muted);
  background: var(--sm-panel-strong);
  cursor: not-allowed;
}
