/* ---- Ferestre ------------------------------------------------------------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(20, 24, 31, 0.5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--se-space-20);
}
.overlay.hidden {
  display: none;
}
.modal-card,
.incoming-card {
  background: var(--se-color-bg-surface);
  border: 1px solid var(--se-color-border-default);
  border-radius: var(--se-radius-lg);
  box-shadow: var(--shadow-float);
  padding: var(--se-space-24);
  width: 440px;
  max-width: 100%;
  max-height: 90dvh;
  overflow-y: auto;
}
.modal-card .section-header h2 {
  font-size: var(--se-type-titlelgsb-size);
  line-height: var(--se-type-titlelgsb-line);
  font-weight: var(--se-type-titlelgsb-weight);
}
.modal-sub {
  font-size: var(--se-type-captionreg-size);
  line-height: var(--se-type-captionreg-line);
  color: var(--se-color-text-muted);
  margin-bottom: var(--se-space-16);
  font-variant-numeric: tabular-nums;
}
.modal-sub:empty {
  display: none;
}
.appt-heard {
  background: var(--se-color-badge-yellow-100);
  color: var(--se-color-badge-yellow-600);
  border-radius: var(--se-radius-md);
  padding: var(--se-space-8) var(--se-space-12);
  margin-bottom: var(--se-space-12);
  font-size: var(--se-type-captionreg-size);
  line-height: var(--se-type-captionreg-line);
}
.appt-heard[hidden] {
  display: none;
}

/* Jurnalul de contactare (waitlist-journal.js): lista derulează în fereastră, ca
   un pacient sunat de douăzeci de ori să nu împingă formularul de sub ea afară
   din ecran. */
.wait-journal-list {
  max-height: 40vh;
  overflow-y: auto;
  margin-bottom: var(--se-space-16);
}
.modal-actions {
  display: flex;
  gap: var(--se-space-8);
  margin-top: var(--se-space-8);
}
.modal-actions .btn-primary {
  flex: 1;
  margin-top: 0;
}
.modal-actions .btn-secondary {
  margin-top: 0;
}
.transcript-body {
  max-height: 50dvh;
  overflow-y: auto;
  font-size: var(--se-type-captionreg-size);
  line-height: var(--se-type-bodyreg-line);
  color: var(--se-color-text-description);
  white-space: pre-wrap;
}
.transcript-body .turn {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: var(--se-space-8);
  padding: 4px 0;
}

/* Apel primit. Numele apelantului e cel mai mare lucru de pe fereastră:
   telefonul sună, omul se uită o clipă și trebuie să plece de la ecran știind cu
   cine vorbește. „Preia”/„Respinge” nu așteaptă căutarea în fișe și nu se mută. */
.incoming-card {
  width: 448px;
  text-align: center;
}
.ring-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  margin: 0 auto var(--se-space-20);
  background: var(--se-color-secondary-20);
  color: var(--se-color-secondary-60);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: ring-pulse 1.4s infinite;
}
.ring-avatar .ph {
  width: 32px;
  height: 32px;
}
@keyframes ring-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 66, 110, 0.28);
  }
  70% {
    box-shadow: 0 0 0 22px rgba(239, 66, 110, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 66, 110, 0);
  }
}
.incoming-name {
  font-size: var(--se-type-h4med-size);
  line-height: var(--se-type-h4med-line);
  font-weight: var(--se-type-bodymed-weight);
  color: var(--se-color-text-title);
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}
.incoming-name.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.incoming-sub {
  font-size: var(--se-type-bodylgmed-size);
  line-height: var(--se-type-bodylgmed-line);
  font-weight: 400;
  color: var(--se-color-text-description);
  margin-bottom: var(--se-space-24);
  overflow-wrap: anywhere;
}
.incoming-file {
  text-align: left;
  margin-bottom: var(--se-space-24);
}
.incoming-file[hidden] {
  display: none;
}
.file-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--se-space-8);
  flex-wrap: wrap;
  margin-bottom: var(--se-space-8);
}
.file-when {
  font-size: var(--se-type-captionreg-size);
  color: var(--se-color-text-muted);
}
.file-acts {
  display: flex;
  justify-content: center;
  gap: var(--se-space-8);
}
.file-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 176px;
  overflow-y: auto;
}
.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--se-space-8);
  padding: var(--se-space-8) var(--se-space-12);
  background: var(--se-color-bg-console);
  border: 1px solid var(--se-color-border-default);
  border-radius: var(--se-radius-md);
}
.file-who {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.file-who b {
  color: var(--se-color-text-title);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-who small {
  font-size: var(--se-type-microreg-size);
  line-height: var(--se-type-microreg-line);
  color: var(--se-color-text-muted);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.incoming-actions {
  display: flex;
  gap: var(--se-space-16);
}
.btn-answer,
.btn-reject {
  flex: 1;
  border: none;
  border-radius: var(--se-radius-pill);
  padding: 10px var(--se-space-24);
  min-height: var(--se-size-control);
  font-size: var(--se-type-bodymed-size);
  font-weight: var(--se-type-bodymed-weight);
  color: var(--se-color-text-on-dark);
}
.btn-answer {
  background: var(--se-color-badge-green-600);
}
.btn-reject {
  background: var(--se-color-alert-red-600);
}
.btn-answer:hover,
.btn-reject:hover {
  filter: brightness(1.08);
}

/* Bun venit, la prima autentificare pe browserul ăsta. */
.welcome-card {
  background: var(--se-color-bg-surface);
  border-radius: var(--se-radius-lg);
  box-shadow: var(--shadow-float);
  padding: 40px 48px;
  width: 640px;
  max-width: 100%;
  position: relative;
  text-align: center;
  max-height: 90dvh;
  overflow-y: auto;
}
.welcome-close {
  position: absolute;
  top: var(--se-space-20);
  right: var(--se-space-20);
}
.welcome-title {
  font-size: var(--se-type-h4med-size);
  line-height: var(--se-type-h4med-line);
  font-weight: var(--se-type-h4med-weight);
  color: var(--se-color-text-title);
  margin-bottom: var(--se-space-12);
}
.welcome-sub {
  font-size: var(--se-type-bodyreg-size);
  line-height: var(--se-type-bodyreg-line);
  color: var(--se-color-text-description);
  max-width: 460px;
  margin: 0 auto var(--se-space-28);
}
.welcome-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--se-space-8);
  margin-bottom: var(--se-space-28);
}
.welcome-feature {
  background: var(--se-color-bg-console);
  border: 1px solid var(--se-color-border-default);
  border-radius: var(--se-radius-lg);
  padding: var(--se-space-24) var(--se-space-16);
}
.welcome-feature-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--se-color-secondary-20);
  color: var(--se-color-secondary-60);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--se-space-16);
}
.welcome-feature-icon .ph {
  width: 28px;
  height: 28px;
}
.welcome-feature h3 {
  font-size: var(--se-type-bodysb-size);
  line-height: var(--se-type-bodysb-line);
  font-weight: var(--se-type-bodysb-weight);
  color: var(--se-color-text-title);
  margin-bottom: 6px;
}
.welcome-feature p {
  font-size: var(--se-type-captionreg-size);
  line-height: var(--se-type-captionreg-line);
  color: var(--se-color-text-description);
}
.welcome-note {
  margin-bottom: var(--se-space-28);
}
.welcome-note-title {
  font-size: var(--se-type-bodymed-size);
  line-height: var(--se-type-bodymed-line);
  font-weight: var(--se-type-bodymed-weight);
  color: var(--se-color-text-title);
  margin-bottom: 4px;
}
.welcome-note-sub {
  font-size: var(--se-type-bodyreg-size);
  line-height: var(--se-type-bodyreg-line);
  color: var(--se-color-text-description);
}
.welcome-start {
  width: auto;
  margin-top: 0;
}

/* Tur ghidat: reflectorul e o umbră uriașă în jurul unei ferestre decupate. */
.tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 550;
}
.tour-highlight {
  position: fixed;
  border-radius: var(--se-radius-lg);
  box-shadow: 0 0 0 9999px rgba(20, 24, 31, 0.55);
  transition: all 0.25s ease;
  pointer-events: none;
}
.tour-tooltip {
  position: fixed;
  background: var(--se-color-bg-surface);
  border-radius: var(--se-radius-lg);
  padding: 18px var(--se-space-20);
  width: 280px;
  box-shadow: var(--shadow-float);
  transition: all 0.25s ease;
}
.tour-step-count {
  font-size: var(--se-type-captionmed-size);
  line-height: var(--se-type-captionmed-line);
  font-weight: var(--se-type-bodysb-weight);
  color: var(--se-color-text-description);
  margin-bottom: 6px;
}
.tour-tooltip h4 {
  font-size: var(--se-type-bodysb-size);
  line-height: var(--se-type-bodysb-line);
  font-weight: var(--se-type-bodysb-weight);
  color: var(--se-color-text-title);
  margin-bottom: 6px;
}
.tour-tooltip p {
  font-size: var(--se-type-captionreg-size);
  line-height: var(--se-type-captionreg-line);
  color: var(--se-color-text-description);
  margin-bottom: var(--se-space-14);
}
.tour-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.tour-skip {
  background: none;
  border: none;
  padding: 0;
  text-decoration: underline;
  color: var(--se-color-text-description);
  font-size: var(--se-type-captionreg-size);
}
.tour-next {
  width: auto;
  padding: var(--se-space-8) var(--se-space-20);
  min-height: 36px;
  font-size: var(--se-type-captionmed-size);
}

/* Toast: un cerc care se lungește cât să încapă textul și se strânge la loc. */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(10px);
  background: var(--se-color-secondary-60);
  color: var(--se-color-text-on-dark);
  height: var(--se-size-control);
  width: var(--se-size-control);
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  z-index: 600;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    width 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    border-radius 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.toast-text {
  opacity: 0;
  padding: 0 18px;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  border-radius: 22px;
}
.toast.show-text .toast-text {
  opacity: 1;
}

/* ---- Completarea LIVE din conversație (P2, live-fill-wire.js) --------------
   Subtitlul spune REGULA (se completează singur, poți edita oricând); jetonul
   marchează CÂMPUL scris de mașină și dispare la prima tastă a operatorului. */
.live-fill-sub {
  color: var(--se-color-badge-blue-600);
}
/* Avertismentul de dublură al fișei (E, action-form.js): „există deja o fișă",
   cu deschiderea ei ca acțiune primară — un avertisment, nu un refuz, deci
   chenar de atenție, nu de eroare. */
.form-conflict {
  padding: var(--se-space-8) var(--se-space-12);
  border: 1px dashed var(--se-color-status-warning);
  border-radius: var(--se-radius-lg);
  font-size: var(--se-type-captionreg-size);
  line-height: var(--se-type-captionreg-line);
  color: var(--se-color-text-title);
}
.form-conflict .modal-actions {
  margin-top: var(--se-space-8);
}
.live-chip {
  display: inline-block;
  margin-left: var(--se-space-8);
  padding: 1px 8px;
  border-radius: 999px;
  vertical-align: middle;
  background: var(--se-color-badge-blue-100);
  color: var(--se-color-badge-blue-600);
  font-size: var(--se-type-microreg-size);
  line-height: var(--se-type-captionreg-line);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.setari-field.live-filled input,
.setari-field.live-filled textarea,
.setari-field.live-filled select,
.setari-field.live-filled .cal-field {
  background: var(--se-color-badge-blue-100);
  border-color: var(--se-color-badge-blue-600);
}

/* ---- Legarea a două numere: cele trei trepte ------------------------------
   Cardul ia locul formularului în ACEEAȘI cochilie (`#bridgeModal`,
   overlays.html), niciodată amândouă pe ecran. Fiecare lucru care se mișcă aici
   ține de o FAZĂ a lui `bridge-phase.js`: punctul pulsează cât treapta e activă,
   linia se umple când cea de deasupra s-a încheiat, bifa sare când o treaptă se
   închide. Nimic nu se învârte la nesfârșit fără înțeles — o stare pe care n-o
   vedem e faza `unwatched`, care se SCRIE, nu se pulsează peste. */
#bridgeProgress {
  display: block;
  position: relative;
}
/* A cincea corectură din familia „clasa bate atributul": regula de deasupra dă
   `display:block` pe un id, deci `[hidden]` din foaia browserului nu mai ajunge
   la el, iar cardul ar sta permanent sub formular. */
#bridgeProgress[hidden] {
  display: none;
}
#bridgeProgress[data-demo="1"]::before {
  content: "SIMULARE";
  display: inline-block;
  margin-bottom: var(--se-space-12);
  padding: 2px var(--se-space-8);
  border-radius: var(--se-radius-pill);
  background: var(--se-color-badge-yellow-100);
  color: var(--se-color-badge-yellow-600);
  font-size: var(--se-type-micromed-size);
  line-height: var(--se-type-micromed-line);
  font-weight: var(--se-type-micromed-weight);
  letter-spacing: 0.06em;
}
.bridge-steps {
  list-style: none;
  margin: 0 0 var(--se-space-16);
  padding: 0;
}
.bridge-step {
  position: relative;
  display: flex;
  gap: var(--se-space-12);
  padding-bottom: var(--se-space-20);
}
.bridge-step:last-child {
  padding-bottom: 0;
}
/* Conectorul e o PISTĂ și umplerea ei, desenate pe treapta de JOS: CSS nu poate
   privi înapoi, deci `bridge-progress.js` pune `is-linked` pe treapta a cărei
   predecesoare s-a încheiat. */
.bridge-step:not(:first-child)::before,
.bridge-step:not(:first-child)::after {
  content: "";
  position: absolute;
  left: 13px;
  top: calc(-1 * var(--se-space-20));
  width: 2px;
  height: var(--se-space-20);
}
.bridge-step:not(:first-child)::before {
  background: var(--se-color-border-default);
}
.bridge-step:not(:first-child)::after {
  background: var(--se-color-status-success);
  transform: scaleY(0);
  transform-origin: top;
}
.bridge-step.is-linked::after {
  transform: scaleY(1);
}
.bridge-dot {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--se-color-fill-neutral);
  color: var(--se-color-text-muted);
  border: 1px solid var(--se-color-border-default);
}
.bridge-dot .ph {
  width: 16px;
  height: 16px;
}
.bridge-pip {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.bridge-step.is-active .bridge-dot {
  background: var(--se-color-secondary-10);
  color: var(--se-color-secondary-60);
  border-color: var(--se-color-secondary-30);
}
.bridge-step.is-done .bridge-dot {
  background: var(--se-color-status-success-bg);
  color: var(--se-color-status-success);
  border-color: var(--se-color-status-success-bg);
}
.bridge-step.is-failed .bridge-dot {
  background: var(--se-color-alert-red-100);
  color: var(--se-color-alert-red-600);
  border-color: var(--se-color-alert-red-100);
}
.bridge-step-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding-top: 3px;
}
.bridge-step-body b {
  font-size: var(--se-type-bodymed-size);
  line-height: var(--se-type-bodymed-line);
  font-weight: var(--se-type-bodymed-weight);
  color: var(--se-color-text-title);
}
.bridge-step.is-pending .bridge-step-body b {
  color: var(--se-color-text-muted);
}
.bridge-step-body small {
  font-size: var(--se-type-captionreg-size);
  line-height: var(--se-type-captionreg-line);
  color: var(--se-color-text-description);
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.bridge-step.is-failed .bridge-step-body small {
  color: var(--se-color-alert-red-600);
}
.bridge-live {
  display: flex;
  align-items: baseline;
  gap: var(--se-space-8);
  padding: var(--se-space-12);
  border-radius: var(--se-radius-md);
  margin-bottom: var(--se-space-12);
  background: var(--se-color-status-success-bg);
  color: var(--se-color-status-success);
}
.bridge-live b {
  font-size: var(--se-type-bodysb-size);
  line-height: var(--se-type-bodysb-line);
  font-weight: var(--se-type-bodysb-weight);
}
.bridge-timer {
  margin-left: auto;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.bridge-note {
  font-size: var(--se-type-captionreg-size);
  line-height: var(--se-type-captionreg-line);
  color: var(--se-color-text-description);
  margin-bottom: var(--se-space-8);
  overflow-wrap: anywhere;
}
/* Vechimea nu se ascunde niciodată — regula pupitrului, peste tot. */
.bridge-age {
  font-size: var(--se-type-microreg-size);
  line-height: var(--se-type-microreg-line);
  color: var(--se-color-text-muted);
  font-variant-numeric: tabular-nums;
  margin-bottom: var(--se-space-8);
}
@keyframes bridge-card-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes bridge-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes bridge-check-pop {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
/* Aceeași bătaie ca `ring-pulse` de mai sus, ca cele două cercuri care sună pe
   consola asta să pulseze la fel; culoarea vine din token prin `color-mix`,
   niciodată dintr-un rgb scris de mână. */
@keyframes bridge-dot-pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--se-color-secondary-60) 30%, transparent);
  }
  70% {
    box-shadow: 0 0 0 10px color-mix(in srgb, var(--se-color-secondary-60) 0%, transparent);
  }
  100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--se-color-secondary-60) 0%, transparent);
  }
}
@media (prefers-reduced-motion: no-preference) {
  #bridgeProgress.enter {
    animation: bridge-card-in var(--motion-dur-base) var(--motion-ease-out);
  }
  #bridgeProgress.enter .bridge-step {
    animation: bridge-card-in var(--motion-dur-base) var(--motion-ease-out) backwards;
    animation-delay: calc(var(--i, 0) * 40ms);
  }
  .bridge-step.is-active .bridge-dot {
    animation: bridge-dot-pulse 1.4s infinite;
  }
  .bridge-step.is-done .bridge-dot .ph {
    animation: bridge-check-pop var(--motion-dur-base) var(--motion-ease-spring);
  }
  .bridge-step:not(:first-child)::after {
    transition: transform var(--motion-dur-base) var(--motion-ease-out);
  }
}
@media (prefers-reduced-motion: reduce) {
  #bridgeProgress.enter,
  .bridge-step.is-done .bridge-dot .ph {
    animation: bridge-fade-in var(--motion-dur-fast) ease-out;
  }
  .bridge-step:not(:first-child)::after {
    transition: none;
  }
}
