/* OPD Queue Manager — Phase 1 dashboard (NEXA only) */

.ia-queue-modal {
  position: fixed;
  inset: 0;
  z-index: 1210;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.ia-queue-modal[hidden] {
  display: none !important;
}

body.ia-queue-modal-open {
  overflow: hidden;
}

.ia-queue-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(6px);
}

.ia-queue-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100vw - 1.25rem));
  max-height: min(94vh, 980px);
  margin: auto;
  display: flex;
  flex-direction: column;
  background: #f7fafc;
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.22);
  overflow: hidden;
}

.ia-queue-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.35rem 0.85rem;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  flex-shrink: 0;
}

.ia-queue-modal__title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.ia-queue-modal__hint {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: #64748b;
}

.ia-queue-modal__close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  border-radius: 8px;
}

.ia-queue-modal__close:hover {
  color: #0f172a;
  background: rgba(15, 23, 42, 0.05);
}

.ia-queue-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.35rem;
  background: #fff;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  flex-shrink: 0;
}

.ia-queue-btn {
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ia-queue-btn:hover:not(:disabled) {
  border-color: rgba(13, 148, 136, 0.35);
  background: rgba(13, 148, 136, 0.06);
}

.ia-queue-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ia-queue-btn--primary {
  background: #0d9488;
  border-color: #0d9488;
  color: #fff;
}

.ia-queue-btn--primary:hover:not(:disabled) {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
}

.ia-queue-btn--ghost {
  background: transparent;
}

.ia-queue-btn--danger {
  color: #b91c1c;
  border-color: rgba(185, 28, 28, 0.25);
}

.ia-queue-btn--danger:hover:not(:disabled) {
  background: rgba(185, 28, 28, 0.06);
  border-color: rgba(185, 28, 28, 0.4);
}

.ia-queue-btn--sm {
  padding: 0.28rem 0.5rem;
  font-size: 0.72rem;
}

.ia-queue-toolbar__spacer {
  flex: 1;
}

.ia-queue-updated {
  font-size: 0.75rem;
  color: #64748b;
}

.ia-queue-modal__scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 1rem 1.35rem 1.35rem;
}

.ia-queue-cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.15rem;
}

.ia-queue-card {
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.ia-queue-card__label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-bottom: 0.35rem;
}

.ia-queue-card__value {
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.ia-queue-card__sub {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: #64748b;
}

.ia-queue-card--current .ia-queue-card__value {
  color: #0d9488;
}

.ia-queue-card--next .ia-queue-card__value {
  color: #0369a1;
}

.ia-queue-section {
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

.ia-queue-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.ia-queue-section__head h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
  color: #0f172a;
}

.ia-queue-table-wrap {
  overflow-x: auto;
}

.ia-queue-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.ia-queue-table th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
  padding: 0.5rem 0.55rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  white-space: nowrap;
}

.ia-queue-table td {
  padding: 0.65rem 0.55rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
  color: #0f172a;
  vertical-align: middle;
}

.ia-queue-table tr:last-child td {
  border-bottom: none;
}

.ia-queue-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 650;
  white-space: nowrap;
}

.ia-queue-badge--waiting {
  background: #ecfeff;
  color: #0e7490;
}

.ia-queue-badge--called {
  background: #fef3c7;
  color: #b45309;
}

.ia-queue-badge--in-consultation {
  background: #dbeafe;
  color: #1d4ed8;
}

.ia-queue-badge--completed {
  background: #d1fae5;
  color: #047857;
}

.ia-queue-badge--cancelled {
  background: #fee2e2;
  color: #b91c1c;
}

.ia-queue-badge--skipped {
  background: #f1f5f9;
  color: #475569;
}

.ia-queue-actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.ia-queue-empty {
  padding: 1.25rem;
  text-align: center;
  color: #64748b;
  font-size: 0.88rem;
}

.ia-queue-feedback {
  margin: 0 1.35rem 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.84rem;
  flex-shrink: 0;
}

.ia-queue-feedback[hidden] {
  display: none !important;
}

.ia-queue-feedback--ok {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid rgba(4, 120, 87, 0.15);
}

.ia-queue-feedback--err {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid rgba(185, 28, 28, 0.15);
}

.ia-queue-panel {
  display: none;
  margin-top: 0.75rem;
  padding: 0.85rem;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.ia-queue-panel.is-open {
  display: block;
}

.ia-queue-panel__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.ia-queue-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: #475569;
}

.ia-queue-field input,
.ia-queue-field select {
  font: inherit;
  font-size: 0.88rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  color: #0f172a;
}

.ia-queue-field--full {
  grid-column: 1 / -1;
}

.ia-queue-candidate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.06);
  margin-bottom: 0.4rem;
}

.ia-queue-candidate__meta {
  font-size: 0.84rem;
  color: #0f172a;
}

.ia-queue-candidate__meta span {
  display: block;
  font-size: 0.74rem;
  color: #64748b;
  margin-top: 0.1rem;
}

@media (max-width: 1100px) {
  .ia-queue-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .ia-queue-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ia-queue-panel__grid {
    grid-template-columns: 1fr;
  }

  .ia-queue-modal__dialog {
    width: calc(100vw - 0.5rem);
    max-height: 96vh;
    border-radius: 12px;
  }

  .ia-queue-doctor-layout {
    grid-template-columns: 1fr;
  }
}

/* --- Production upgrades: tabs, priority, doctor board, timeline --- */

.ia-queue-doctor-pick {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.68rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.ia-queue-lang-pick {
  display: inline-flex;
  align-items: center;
  align-self: center;
  margin: 0;
  padding: 0;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: 0;
  color: inherit;
  text-transform: none;
}

.ia-queue-lang-pick select {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  color: #0f172a;
  min-width: 11.5rem;
  max-width: min(48vw, 16rem);
}

.ia-queue-doctor-pick select {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  color: #0f172a;
  min-width: 8.5rem;
}

.ia-queue-tabs {
  display: inline-flex;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 0.15rem;
  gap: 0.15rem;
}

.ia-queue-tab {
  border: none;
  background: transparent;
  color: #64748b;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
}

.ia-queue-tab.is-active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.ia-queue-btn.is-active {
  border-color: rgba(13, 148, 136, 0.45);
  background: rgba(13, 148, 136, 0.1);
  color: #0f766e;
}

a.ia-queue-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.ia-queue-cards--stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ia-queue-card__value--sm {
  font-size: 1.05rem;
}

.ia-queue-section__head p {
  margin: 0;
  font-size: 0.8rem;
  color: #64748b;
}

.ia-queue-priority {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  background: #f1f5f9;
  color: #475569;
}

.ia-queue-priority--emergency {
  background: #fee2e2;
  color: #b91c1c;
}

.ia-queue-priority--vip {
  background: #fef3c7;
  color: #b45309;
}

.ia-queue-priority--pregnant {
  background: #fce7f3;
  color: #be185d;
}

.ia-queue-priority--child {
  background: #e0e7ff;
  color: #4338ca;
}

.ia-queue-priority--senior {
  background: #ecfeff;
  color: #0e7490;
}

.ia-queue-priority-select {
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.28rem 0.4rem;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  color: #0f172a;
  max-width: 8.5rem;
}

.ia-queue-doctor-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1rem;
}

.ia-queue-doctor-current {
  background: linear-gradient(180deg, #f0fdfa, #fff);
  border: 1px solid rgba(13, 148, 136, 0.18);
  border-radius: 14px;
  padding: 1rem 1.1rem;
}

.ia-queue-doctor-name {
  margin: 0.35rem 0 0.55rem;
  font-size: 1.05rem;
  font-weight: 650;
  color: #0f172a;
}

.ia-queue-doctor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.9rem;
}

.ia-queue-timeline {
  margin-top: 0.85rem;
  display: grid;
  gap: 0.35rem;
}

.ia-queue-timeline__row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: #64748b;
  padding: 0.3rem 0;
  border-bottom: 1px dashed rgba(15, 23, 42, 0.06);
}

.ia-queue-timeline__row strong {
  color: #0f172a;
  font-weight: 650;
}

.ia-queue-next-list {
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 14px;
  padding: 0.9rem 1rem;
}

.ia-queue-next-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 0.45rem;
  align-items: center;
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
  font-size: 0.84rem;
}

.ia-queue-next-item:last-child {
  border-bottom: none;
}

.ia-queue-next-item em {
  font-style: normal;
  color: #94a3b8;
  font-size: 0.72rem;
}

.ia-queue-tl-cell {
  font-size: 0.72rem;
  color: #64748b;
  white-space: nowrap;
}

.ia-queue-candidate {
  flex-wrap: wrap;
}

.ia-queue-modal__dialog {
  width: min(1320px, calc(100vw - 1.25rem));
}
