/* Demonstrações da API Oficial da Meta (assets/js/meta-demo.js): disparo de campanha,
   aprovação de template e qualidade do número. Funciona em fundo claro e, com a classe
   .demo-dark no contêiner, em fundo escuro. */

.dispatch,
.tpl-demo,
.quality-demo {
  --demo-fg: #475569;
  --demo-strong: #0f172a;
  --demo-line: #d5deeb;
  --demo-accent: #234085;
  --demo-accent-bg: #eef3fd;
  position: relative;
  min-width: 0;
  font-family: var(--font-sans, 'Inter', system-ui, sans-serif);
}

.demo-dark {
  --demo-fg: #b8c7e2;
  --demo-strong: #ffffff;
  --demo-line: #ffffff2e;
  --demo-accent: #d1ff52;
  --demo-accent-bg: #d1ff5212;
}

[data-dispatch-demo]:empty {
  min-height: 520px;
}

[data-template-demo]:empty,
[data-quality-demo]:empty {
  min-height: 380px;
}

/* ---------- Botão de pausar/retomar ---------- */
.demo-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--demo-line);
  border-radius: 999px;
  background: transparent;
  color: var(--demo-strong);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

.demo-toggle:hover {
  border-color: var(--demo-accent);
}

.demo-toggle:focus-visible {
  outline: 3px solid #6e9af2;
  outline-offset: 3px;
}

.demo-toggle-play,
.is-paused .demo-toggle-pause {
  display: none;
}

.is-paused .demo-toggle-play,
.demo-toggle-pause {
  display: inline-flex;
}

.demo-controls {
  display: flex;
  justify-content: flex-end;
  max-width: 480px;
  margin: 12px auto 0;
}

/* ==========================================================================
   Disparo de campanha
   ========================================================================== */
.dispatch {
  container-type: inline-size;
}

.dispatch-window {
  overflow: hidden;
  border: 1px solid #8da9e04d;
  border-radius: 14px;
  background: #fff;
  color: #17243b;
  box-shadow:
    0 32px 90px -24px #0a163180,
    0 0 0 7px #ffffff08;
}

.dispatch-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 38px;
  padding: 0 12px;
  border-bottom: 1px solid #e4e9f3;
  background: #f5f7fc;
  color: #475569;
  font-size: 0.75rem;
}

.dispatch-lights {
  display: flex;
  gap: 4px;
}

.dispatch-lights i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ff7c75;
}

.dispatch-lights i:nth-child(2) {
  background: #f3c153;
}

.dispatch-lights i:nth-child(3) {
  background: #67c89c;
}

.dispatch-bar-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.dispatch-conn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #e3f5ea;
  color: #1a6141;
  font-size: 0.6875rem;
  font-weight: 700;
  white-space: nowrap;
}

.dispatch-conn i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.dispatch-body {
  position: relative;
  height: 430px;
  background: #f6f8fc;
  transition: opacity 0.5s ease;
}

.dispatch-body.is-resetting {
  opacity: 0.25;
}

.dispatch-view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition:
    opacity 0.45s ease,
    transform 0.45s ease,
    visibility 0.45s;
}

.dispatch-view.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.dispatch-heading {
  font-size: 0.875rem;
  font-weight: 700;
}

.dispatch-field {
  position: relative;
  display: grid;
  gap: 5px;
}

.dispatch-label {
  color: #52617a;
  font-size: 0.6875rem;
  font-weight: 600;
}

.dispatch-input,
.dispatch-select {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #d6deeb;
  border-radius: 8px;
  background: #fff;
  color: #17243b;
  font-size: 0.8125rem;
  transition:
    border-color 0.25s ease,
    box-shadow 0.25s ease,
    background-color 0.25s ease;
}

.dispatch-select .icon {
  margin-left: auto;
  color: #64748b;
}

.dispatch-input.is-focused,
.dispatch-select.is-focused {
  border-color: #3f70d7;
  box-shadow: 0 0 0 3px #3f70d724;
}

.dispatch-placeholder {
  color: #7b8799;
}

.dispatch-input.has-value .dispatch-placeholder {
  display: none;
}

.dispatch-caret {
  display: none;
  width: 1px;
  height: 15px;
  margin-left: -4px;
  background: #234085;
}

.dispatch-input.is-focused .dispatch-caret {
  display: inline-block;
}

.is-running .dispatch-input.is-focused .dispatch-caret {
  animation: demo-blink 1s steps(2) infinite;
}

.dispatch-template {
  min-height: 122px;
}

.dispatch-template-card {
  display: none;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #c9d6ee;
  border-radius: 10px;
  background: #fff;
}

.dispatch-template.is-picked .dispatch-template-empty {
  display: none;
}

.dispatch-template.is-picked .dispatch-template-card {
  display: grid;
  animation: demo-pop-in 0.4s ease both;
}

.dispatch-template-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.dispatch-template-head code {
  padding: 2px 6px;
  border: 0;
  border-radius: 5px;
  background: #eef2fa;
  color: #234085;
  font-size: 0.6875rem;
  word-break: normal;
}

.dispatch-tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff1d9;
  color: #7f4f0a;
  font-size: 0.6875rem;
  font-weight: 600;
}

.dispatch-approved {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 3px 9px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-size: 0.6875rem;
  font-weight: 700;
  opacity: 0;
  transform: scale(0.6);
  transition:
    opacity 0.3s ease,
    transform 0.45s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.dispatch-approved.is-on {
  opacity: 1;
  transform: none;
}

.dispatch-bubble {
  padding: 8px 10px;
  border-radius: 2px 9px 9px 9px;
  background: #e4f1dc;
  color: #1f2d44;
  font-size: 0.75rem;
  line-height: 1.5;
}

.dispatch-bubble mark,
.tpl-var-key {
  padding: 0 2px;
  border-radius: 4px;
  background: #fff2bf;
  color: #6b4700;
  font-weight: 700;
}

.dispatch-quick {
  display: flex;
  gap: 6px;
}

.dispatch-quick span {
  flex: 1;
  padding: 5px;
  border: 1px solid #dbe4f3;
  border-radius: 6px;
  background: #fff;
  color: #1d55ad;
  font-size: 0.6875rem;
  font-weight: 600;
  text-align: center;
}

.dispatch-select.is-picked {
  border-color: #b9cbf2;
  background: #f5f8ff;
  font-weight: 600;
}

.dispatch-options {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 3;
  margin-top: 4px;
  padding: 4px;
  list-style: none;
  border: 1px solid #d6deeb;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 14px 30px -12px #14254640;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    visibility 0.2s;
}

.dispatch-options.is-open {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.dispatch-options li {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
  border-radius: 6px;
  color: #33445e;
  font-size: 0.75rem;
}

.dispatch-options li.is-hover {
  background: #eef3fd;
  color: #234085;
  font-weight: 600;
}

.dispatch-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
}

.dispatch-optin {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #1a6141;
  font-size: 0.6875rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.dispatch-optin.is-on {
  opacity: 1;
}

.dispatch-send {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  margin-left: auto;
  padding: 0 14px;
  border-radius: 8px;
  background: #234085;
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
  opacity: 0.45;
  transition:
    opacity 0.3s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.dispatch-send.is-ready {
  opacity: 1;
}

.dispatch-send.is-pressed {
  transform: scale(0.95);
  box-shadow: 0 0 0 4px #3f70d740;
}

/* Relatório do envio */
.dispatch-report-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dispatch-report-name {
  min-width: 0;
}

.dispatch-report-name b {
  display: block;
  font-size: 0.875rem;
}

.dispatch-report-name small {
  display: block;
  overflow: hidden;
  color: #52617a;
  font-size: 0.6875rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.dispatch-state {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e8eefc;
  color: #234085;
  font-size: 0.6875rem;
  font-weight: 700;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

.dispatch-state.is-done {
  background: #dcfce7;
  color: #166534;
}

.dispatch-progress {
  display: grid;
  gap: 5px;
}

.dispatch-progress-bar {
  height: 7px;
  overflow: hidden;
  border-radius: 4px;
  background: #e2e9f3;
}

.dispatch-progress-bar span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #3f70d7, #2f9a5f);
  transform: scaleX(0);
  transform-origin: left;
}

.dispatch-progress small {
  color: #52617a;
  font-size: 0.6875rem;
}

.dispatch-progress b {
  color: #17243b;
  font-variant-numeric: tabular-nums;
}

.dispatch-counters {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  list-style: none;
}

.dispatch-counters li {
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid #e1e8f2;
  border-radius: 8px;
  background: #fff;
}

.dispatch-counters small {
  display: block;
  overflow: hidden;
  color: #52617a;
  font-size: 0.65625rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.dispatch-counters b {
  display: block;
  margin-top: 2px;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.dispatch-counters .is-sent b {
  color: #234085;
}

.dispatch-counters .is-delivered b {
  color: #0b5f8a;
}

.dispatch-counters .is-read b {
  color: #1d4ed8;
}

.dispatch-counters .is-replied b {
  color: #15803d;
}

.dispatch-counters .is-failed b {
  color: #b91c1c;
}

.dispatch-log {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #e1e8f2;
  border-radius: 8px;
  background: #fff;
}

.dispatch-log ul {
  list-style: none;
}

.dispatch-log-head,
.dispatch-row {
  display: grid;
  grid-template-columns: 112px 96px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 0 10px;
}

.dispatch-log-head {
  height: 24px;
  border-bottom: 1px solid #eef2f7;
  background: #f8fafc;
  color: #5b6b84;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.dispatch-row {
  min-height: 29px;
  border-bottom: 1px solid #f0f3f7;
  font-size: 0.71875rem;
  transition: background-color 0.4s ease;
}

.dispatch-row:last-child {
  border-bottom: 0;
}

.dispatch-row.is-failed {
  background: #fff8f8;
}

.dispatch-phone {
  color: #22324a;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dispatch-status {
  justify-self: start;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2f7;
  color: #475569;
  font-size: 0.65625rem;
  font-weight: 700;
  white-space: nowrap;
  transition:
    background-color 0.35s ease,
    color 0.35s ease;
}

.dispatch-status[data-status='sent'] {
  background: #e8eefc;
  color: #234085;
}

.dispatch-status[data-status='delivered'] {
  background: #e0f2fe;
  color: #0b5f8a;
}

.dispatch-status[data-status='read'] {
  background: #dbeafe;
  color: #1d4ed8;
}

.dispatch-status[data-status='replied'] {
  background: #dcfce7;
  color: #166534;
}

.dispatch-status[data-status='failed'] {
  background: #fee2e2;
  color: #b91c1c;
}

.dispatch-status[data-status='sent']::before,
.dispatch-status[data-status='delivered']::before,
.dispatch-status[data-status='read']::before {
  content: '✓';
  margin-right: 4px;
}

.dispatch-status[data-status='delivered']::before,
.dispatch-status[data-status='read']::before {
  content: '✓✓';
  letter-spacing: -0.2em;
  margin-right: 6px;
}

.dispatch-detail {
  min-width: 0;
  overflow: hidden;
  color: #52617a;
  font-size: 0.6875rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.dispatch-detail[data-kind='reason'] {
  color: #b91c1c;
  font-weight: 600;
}

.dispatch-detail[data-kind='reply'] {
  color: #22324a;
  font-style: italic;
}

.dispatch-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.65625rem;
  font-weight: 700;
  animation: demo-pop-in 0.35s ease both;
}

.dispatch-chip.is-ia {
  background: #efe7ff;
  color: #5b34a6;
}

.dispatch-chip.is-queue {
  background: #e3ebfd;
  color: #234085;
}

/* Cursor: só aparece enquanto a campanha é montada e nunca durante o relatório. */
.dispatch-cursor {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  margin: -3px 0 0 -5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.dispatch-cursor.is-on {
  opacity: 1;
}

.dispatch-cursor svg {
  display: block;
  filter: drop-shadow(0 2px 3px #0f172a40);
}

.dispatch-cursor path {
  fill: #0f172a;
  stroke: #fff;
  stroke-width: 1.4;
  stroke-linejoin: round;
}

.dispatch-cursor-ring {
  position: absolute;
  top: -9px;
  left: -8px;
  width: 26px;
  height: 26px;
  border: 2px solid #3f70d7;
  border-radius: 50%;
  opacity: 0;
}

.dispatch-cursor.is-click .dispatch-cursor-ring {
  animation: demo-ring 0.45s ease-out;
}

.is-static .dispatch-cursor {
  display: none;
}

/* Etapas e controle abaixo da janela */
.dispatch-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.dispatch-steps {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
  list-style: none;
}

.dispatch-steps li {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--demo-line);
  border-radius: 8px;
  color: var(--demo-fg);
  font-size: 0.71875rem;
  font-weight: 600;
  line-height: 1.25;
  transition:
    border-color 0.3s ease,
    color 0.3s ease,
    background-color 0.3s ease;
}

.dispatch-steps b {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 0.625rem;
}

.dispatch-steps li.is-done {
  color: var(--demo-strong);
}

.dispatch-steps li.is-current {
  border-color: var(--demo-accent);
  background: var(--demo-accent-bg);
}

.dispatch-steps li.is-done b {
  border-color: var(--demo-accent);
  background: var(--demo-accent);
  color: #0a1631;
}

.dispatch:not(.demo-dark) .dispatch-steps li.is-done b {
  color: #fff;
}

/* Contêiner estreito (celular e colunas apertadas) */
@container (max-width: 520px) {
  .dispatch-body {
    height: 540px;
  }

  .dispatch-view {
    gap: 10px;
    padding: 12px;
  }

  .dispatch-counters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dispatch-log-head,
  .dispatch-row {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 3px;
  }

  .dispatch-log-head span:last-child {
    display: none;
  }

  .dispatch-row {
    padding-block: 5px;
  }

  .dispatch-detail {
    grid-column: 1 / -1;
  }

  .dispatch-detail:empty {
    display: none;
  }

  .dispatch-row:nth-child(n + 6) {
    display: none;
  }

  .dispatch-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dispatch-steps li {
    padding: 6px 7px;
    font-size: 0.6875rem;
  }
}

@container (max-width: 360px) {
  .dispatch-bar {
    gap: 8px;
  }

  .dispatch-lights {
    display: none;
  }

  .dispatch-quick span,
  .dispatch-options li {
    font-size: 0.65625rem;
  }

  .dispatch-controls {
    align-items: flex-start;
  }
}

/* ==========================================================================
   Template em análise
   ========================================================================== */
.tpl-card,
.quality-card {
  display: grid;
  gap: 14px;
  max-width: 480px;
  margin-inline: auto;
  padding: 20px;
  border: 1px solid #dfe6f2;
  border-radius: 18px;
  background: #fff;
  color: #17243b;
  box-shadow: 0 28px 60px -30px #23408566;
}

.tpl-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.tpl-name code {
  padding: 0;
  border: 0;
  background: none;
  color: #17243b;
  font-size: 0.875rem;
  font-weight: 700;
  word-break: normal;
}

.tpl-name small {
  display: block;
  margin-top: 3px;
  color: #52617a;
  font-size: 0.75rem;
}

.tpl-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

.tpl-status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.tpl-status[data-state='review'] {
  background: #fff4dc;
  color: #7f4f0a;
}

.tpl-status[data-state='review'] i {
  border: 2px solid currentColor;
  border-right-color: transparent;
  background: transparent;
}

.is-running .tpl-status[data-state='review'] i {
  animation: demo-spin 0.8s linear infinite;
}

.tpl-status[data-state='approved'] {
  background: #dcfce7;
  color: #166534;
}

.tpl-track {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  list-style: none;
}

.tpl-track li {
  padding-top: 7px;
  border-top: 3px solid #e2e8f0;
  color: #52617a;
  font-size: 0.75rem;
  transition:
    border-color 0.3s ease,
    color 0.3s ease;
}

.tpl-track li.is-current {
  border-color: #e09a00;
  color: #7f4f0a;
  font-weight: 600;
}

.tpl-track li.is-done {
  border-color: #22a05b;
  color: #166534;
  font-weight: 600;
}

.tpl-preview {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 12px;
  background: #ece5dd;
}

.tpl-bubble {
  padding: 10px 12px 6px;
  border-radius: 2px 10px 10px 10px;
  background: #fff;
  color: #1f2d44;
  font-size: 0.875rem;
  line-height: 1.6;
  box-shadow: 0 1px 1px #0000000f;
}

.tpl-bubble time {
  display: block;
  color: #66758a;
  font-size: 0.6875rem;
  text-align: right;
}

.tpl-var-value {
  display: none;
  padding: 0 3px;
  border-radius: 4px;
  background: #e3ebfd;
  color: #234085;
  font-weight: 700;
}

.tpl-var.is-filled .tpl-var-key {
  display: none;
}

.tpl-var.is-filled .tpl-var-value {
  display: inline;
}

.is-running .tpl-var.is-filled .tpl-var-value {
  animation: demo-fade-in 0.35s ease both;
}

.tpl-buttons {
  display: grid;
  gap: 6px;
}

.tpl-buttons span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  border-radius: 8px;
  background: #fff;
  color: #1d55ad;
  font-size: 0.8125rem;
  font-weight: 600;
}

.tpl-note {
  min-height: 2.8em;
  color: #52617a;
  font-size: 0.8125rem;
}

/* ==========================================================================
   Qualidade do número
   ========================================================================== */
.quality-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.quality-number b {
  display: block;
  font-size: 0.9375rem;
}

.quality-number small {
  color: #52617a;
  font-size: 0.75rem;
}

.quality-conn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #166534;
  font-size: 0.75rem;
  font-weight: 600;
}

.quality-conn i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22a05b;
}

.quality-rating {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.quality-rating small,
.quality-limit small {
  color: #475569;
  font-size: 0.8125rem;
  font-weight: 600;
}

.quality-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 0.875rem;
  transition:
    background-color 0.4s ease,
    color 0.4s ease;
}

.quality-badge i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
}

.quality-badge[data-level='high'] {
  background: #dcfce7;
  color: #166534;
}

.quality-badge[data-level='medium'] {
  background: #fef3c7;
  color: #7f4f0a;
}

.quality-badge[data-level='low'] {
  background: #fee2e2;
  color: #b91c1c;
}

.quality-scale {
  position: relative;
  padding-top: 6px;
}

.quality-track {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  height: 10px;
}

.quality-track i {
  border-radius: 5px;
  opacity: 0.3;
  transition: opacity 0.4s ease;
}

.quality-track .is-low {
  background: #dc2626;
}

.quality-track .is-medium {
  background: #e0a100;
}

.quality-track .is-high {
  background: #16a34a;
}

.quality-card[data-level='low'] .is-low,
.quality-card[data-level='medium'] .is-medium,
.quality-card[data-level='high'] .is-high {
  opacity: 1;
}

.quality-marker {
  position: absolute;
  top: 0;
  left: 83.33%;
  width: 22px;
  height: 22px;
  margin-left: -11px;
  border: 3px solid #17243b;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px #0f172a33;
  transition: left 0.9s cubic-bezier(0.5, 0, 0.2, 1);
}

.quality-scale-labels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 10px;
  color: #475569;
  font-size: 0.75rem;
  text-align: center;
}

.quality-limit p {
  color: #334155;
  font-size: 0.875rem;
}

.quality-limit b {
  color: #17243b;
  font-size: 1.375rem;
  font-variant-numeric: tabular-nums;
  transition: color 0.4s ease;
}

.quality-limit b.is-up {
  color: #166534;
}

.quality-event {
  min-height: 3.6em;
  padding: 10px 12px;
  border-left: 3px solid #16a34a;
  border-radius: 10px;
  background: #f5f7fc;
  color: #22324a;
  font-size: 0.8125rem;
  transition: border-color 0.4s ease;
}

.quality-card[data-level='medium'] .quality-event {
  border-left-color: #e0a100;
}

.quality-card[data-level='low'] .quality-event {
  border-left-color: #dc2626;
}

/* ---------- Animações ---------- */
@keyframes demo-blink {
  50% {
    opacity: 0;
  }
}

@keyframes demo-pop-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes demo-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes demo-ring {
  from {
    opacity: 0.9;
    transform: scale(0.3);
  }
  to {
    opacity: 0;
    transform: scale(1.4);
  }
}

@keyframes demo-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .dispatch *,
  .tpl-demo *,
  .quality-demo * {
    animation: none !important;
    transition: none !important;
  }
}

@media (forced-colors: active) {
  .dispatch-status,
  .dispatch-chip,
  .tpl-status,
  .quality-badge {
    border: 1px solid CanvasText;
  }
}
