/* ============================================================
   Gestão de Cupons — estilos específicos da página.
   Usa as variáveis de tema definidas em styles.css (--color-primary etc.)
   e as classes de modal (.agenda-modal-*) de agenda.css.
   ============================================================ */

.cupons-container {
  padding: 20px 20px 64px;
  max-width: 1680px;
  margin: 0 auto;
  overflow-y: auto;
  height: calc(100vh - 60px);
}

.search-box {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
  display: flex;
  gap: 15px;
  align-items: center;
  border: 1px solid #e2e8f0;
  flex-wrap: wrap;
}

.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 250px;
  flex: 0 0 250px;
}

.quick-actions .btn-action {
  width: 100%;
  justify-content: center;
  padding: 9px 14px;
}

.search-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  max-width: 500px;
}

.search-group label {
  font-weight: 600;
  color: #475569;
  font-size: 14px;
  white-space: nowrap;
}

.search-group input {
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 14px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s;
}

.search-group input:focus {
  border-color: var(--color-primary);
}

.btn-search {
  padding: 8px 20px;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
  height: 38px;
}

.btn-search:hover {
  background: var(--color-primary-dark);
}

/* Listagem de Atendimentos */
.atendimentos-toolbar {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.atendimentos-toolbar .counts {
  font-size: 12px;
  color: #475569;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.atendimentos-toolbar .counts strong {
  color: #0f172a;
}

.atendimentos-toolbar .filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill-btn {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.pill-btn.active {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: rgba(91, 58, 171, 0.08);
}

.atendimentos-list-container {
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 15px;
  margin-bottom: 25px;
}

.atendimentos-list-container.list {
  grid-template-columns: 1fr;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding-right: 6px;
}

.atendimentos-list-container.list .atendimento-item {
  padding: 12px 14px;
}

.atendimentos-list-container.list .atendimento-item:hover {
  transform: none;
}

.atendimento-row {
  display: grid;
  grid-template-columns: 130px 1fr auto;
  gap: 12px;
  align-items: center;
}

.atendimento-row .col-left .id {
  font-weight: 800;
  color: #0f172a;
  font-size: 13px;
}

.atendimento-row .col-left .date {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}

.atendimento-row .col-mid .patient {
  font-size: 12px;
  color: #0f172a;
  font-weight: 700;
  line-height: 1.2;
}

.atendimento-row .col-mid .unit {
  font-size: 11px;
  color: #475569;
  margin-top: 3px;
}

.atendimento-row .col-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tag-actionable {
  background: #dcfce7;
  border: 1px solid #bbf7d0;
  color: #166534;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.atendimento-item {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 15px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.atendimento-item:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.atendimento-item.actionable {
  border-left: 4px solid #16a34a;
}

.atendimento-card {
  background: white;
  padding: 0;
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  display: none;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  margin-bottom: 25px;
}

.card-header {
  background: #f8fafc;
  padding: 15px 20px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.card-header-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  flex: 1 1 320px;
}

.card-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.card-header h2 {
  margin: 0;
  color: #1e293b;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.card-header-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  flex: 0 1 360px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
}

.icon-btn:hover:not(:disabled) {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.icon-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.status-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.status-cancelado { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
.status-ativo { background: #dcfce7; color: #16a34a; border: 1px solid #bbf7d0; }
.status-definitivo { background: #dcfce7; color: #16a34a; border: 1px solid #bbf7d0; }
.status-provisorio { background: #fff7ed; color: #c2410c; border: 1px solid #fdba74; }

.nota-fiscal-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  min-width: 0;
  /* Exibida na coluna esquerda, abaixo do nº de atendimento */
  align-self: flex-start;
  max-width: 460px;
}

.nota-fiscal-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  color: #1d4ed8;
}

.nota-fiscal-values {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 12px;
  color: #1e293b;
}

.nota-fiscal-values strong { font-weight: 700; }

.nota-fiscal-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.nota-fiscal-link:hover { text-decoration: underline; }

.card-body { padding: 20px; }

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 25px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-item label {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.info-item span {
  font-size: 15px;
  font-weight: 500;
  color: #334155;
}

.coupon-info {
  background: #fffbeb;
  padding: 15px 20px;
  border: 1px solid #fef3c7;
  border-radius: 8px;
  margin-bottom: 25px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #92400e;
}

.coupon-info i {
  font-size: 20px;
  color: #d97706;
}

.action-area {
  padding: 15px 20px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-action {
  padding: 10px 16px;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  font-size: 13px;
}

.btn-reactivate { background: #16a34a; }
.btn-reactivate:hover:not(:disabled) { background: #15803d; }

.btn-transfer { background: #3b82f6; }
.btn-transfer:hover:not(:disabled) { background: #2563eb; }

.btn-transfer-patient { background: #8b5cf6; }
.btn-transfer-patient:hover:not(:disabled) { background: #7c3aed; }

.btn-summary { background: #0f766e; }
.btn-summary:hover:not(:disabled) { background: #115e59; }

.btn-action:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
  color: #64748b;
}

/* Estado amigável quando a busca não retorna resultados (não é "erro") */
.search-empty-state {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  background: #f5f3ff;
  border: 1px solid #e2d9fb;
  border-radius: 12px;
  padding: 32px 24px;
  margin-bottom: 25px;
}

.search-empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #ede9fe;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 4px;
}

.search-empty-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
}

.search-empty-text {
  margin: 0;
  max-width: 520px;
  font-size: 13.5px;
  line-height: 1.55;
  color: #64748b;
}

/* Histórico */
.history-section {
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
  overflow: hidden;
  display: none;
}

.history-header {
  padding: 15px 20px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 700;
  color: #1e293b;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
}

.history-table th,
.history-table td {
  padding: 12px 20px;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
}

.history-table th {
  background: #fdfdfd;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}

/* Linha do cupom que pertence ao atendimento buscado */
.history-table tr.cupom-linha-atual td {
  background: #fffbeb;
  box-shadow: inset 4px 0 0 #f59e0b;
}

.cupom-selo-atual {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  vertical-align: middle;
}

/* Modal simples (transferência entre atendimentos) */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  padding: 25px;
  border-radius: 8px;
  width: 100%;
  max-width: 450px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-content h3 { margin-top: 0; color: #1e293b; }
.modal-content p { color: #64748b; font-size: 14px; margin-bottom: 20px; }

.form-group { margin-bottom: 20px; }
.form-group input {
  width: 100%;
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  outline: none;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-ghost {
  background: none;
  border: 1px solid #cbd5e1;
  color: #64748b;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
}

/* Wizard de transferência titular -> dependente */
.transfer-wizard-modal {
  max-width: 920px;
  width: 95%;
}

.transfer-stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.transfer-step {
  border: 1px solid #dbe3ef;
  background: #f8fafc;
  color: #64748b;
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.transfer-step.active {
  border-color: rgba(91, 58, 171, 0.25);
  background: rgba(91, 58, 171, 0.1);
  color: var(--color-primary);
}

.transfer-step.done {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #16a34a;
}

.transfer-pane { display: none; }
.transfer-pane.active { display: block; }

.transfer-helper {
  margin-bottom: 14px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.5;
}

.transfer-status {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #475569;
  font-size: 13px;
}

.transfer-status.loading {
  color: var(--color-primary);
  background: #f5f3ff;
  border-color: rgba(91, 58, 171, 0.2);
}

.transfer-status.error {
  color: #b91c1c;
  background: #fef2f2;
  border-color: #fecaca;
}

.transfer-context {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-size: 13px;
}

.transfer-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.transfer-card {
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  background: #fff;
  padding: 14px;
  text-align: left;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.transfer-card:hover {
  border-color: var(--color-primary);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(91, 58, 171, 0.12);
}

.transfer-card.selected {
  border-color: var(--color-primary);
  background: #f7f3ff;
  box-shadow: 0 0 0 2px rgba(91, 58, 171, 0.1);
}

.transfer-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-weight: 800;
  color: #0f172a;
}

.transfer-card-meta {
  font-size: 12px;
  color: #475569;
  display: flex;
  flex-direction: column;
  gap: 4px;
  line-height: 1.45;
}

.transfer-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.transfer-badge.info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.transfer-badge.success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.transfer-badge.warning { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }

.transfer-empty {
  grid-column: 1 / -1;
  padding: 22px 16px;
  text-align: center;
  border-radius: 12px;
  border: 1px dashed #dbe3ef;
  background: #fafcff;
  color: #64748b;
}

.transfer-empty i {
  display: block;
  margin-bottom: 8px;
  font-size: 24px;
  color: var(--color-primary);
}

.transfer-confirm-box { display: grid; gap: 12px; }

.transfer-confirm-row {
  padding: 12px 14px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #334155;
  line-height: 1.5;
}

/* Resumo de cupons */
.summary-modal { max-width: 1372px; width: 95%; }

.summary-meta {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-size: 13px;
}

.summary-table-wrap {
  max-height: 55vh;
  overflow: auto;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.summary-search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.summary-search-bar input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.summary-search-bar input:focus { border-color: #0f766e; }

.summary-search-status {
  font-size: 13px;
  min-height: 18px;
  margin-bottom: 8px;
  color: #475569;
}

.summary-search-status.error { color: #dc2626; }
.summary-search-status.loading { color: #0f766e; }

/* Botão e modal de Auditoria (perfil 1848) */
.btn-audit { background: #b45309; }
.btn-audit:hover:not(:disabled) { background: #92400e; }

.auditoria-modal { max-width: 1680px; width: 97%; }

.auditoria-filtros {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.auditoria-field { display: flex; flex-direction: column; gap: 4px; }

.auditoria-field label {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.auditoria-field input,
.auditoria-field select {
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
  background: #fff;
}

.auditoria-field input:focus,
.auditoria-field select:focus { border-color: #b45309; }

.auditoria-field-actions { justify-content: flex-end; }
.auditoria-field-actions .btn-action { width: 100%; justify-content: center; }

.auditoria-status {
  font-size: 13px;
  min-height: 18px;
  margin-bottom: 8px;
  color: #475569;
}
.auditoria-status.error { color: #dc2626; }
.auditoria-status.loading { color: #b45309; }

.auditoria-table-wrap {
  max-height: 52vh;
  overflow: auto;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.auditoria-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.auditoria-table td { vertical-align: top; }

.auditoria-table td.col-detalhes {
  font-size: 12px;
  color: #475569;
  max-width: 380px;
  white-space: normal;
  word-break: break-word;
}

.aud-acao-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  border: 1px solid transparent;
}
.aud-acao-badge.escrita { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.aud-acao-badge.leitura { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }

.auditoria-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 12px;
  font-size: 13px;
  color: #475569;
}

.auditoria-pager .btn-ghost { padding: 6px 12px; }
.auditoria-pager .btn-ghost:disabled { opacity: 0.45; cursor: not-allowed; }

.agenda-modal-footer .auditoria-export {
  display: flex;
  gap: 10px;
  margin-right: auto;
}

.auditoria-empty {
  padding: 24px 16px;
  text-align: center;
  color: #64748b;
}

/* Autocomplete de paciente (nome ou CPF) */
.ac-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 2000;
  margin-top: 4px;
  background: #fff;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.14);
  max-height: 280px;
  overflow-y: auto;
}

.ac-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
}

.ac-item:last-child { border-bottom: none; }
.ac-item:hover,
.ac-item.active { background: #f5f3ff; }

.ac-item .ac-name { font-weight: 700; font-size: 13px; color: #0f172a; }
.ac-item .ac-meta { font-size: 12px; color: #64748b; }

.ac-empty { padding: 10px 12px; font-size: 13px; color: #94a3b8; }

/* ===== Dashboard executivo da Auditoria de Cupons ===== */
.aud-dash {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.aud-dash-loading,
.aud-dash-erro {
  padding: 20px;
  text-align: center;
  color: #64748b;
  font-size: 13px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
}
.aud-dash-erro { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }

.aud-dash-secao {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
}
.aud-dash-titulo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 12px;
}
.aud-dash-titulo i { color: var(--color-primary); }
.aud-dash-periodo {
  font-weight: 600;
  font-size: 11px;
  color: #94a3b8;
  text-transform: none;
  letter-spacing: 0;
}

.aud-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.aud-stat {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #94a3b8;
  border-radius: 10px;
  padding: 12px 14px;
}
.aud-stat-num { font-size: 26px; font-weight: 800; line-height: 1.1; color: #0f172a; }
.aud-stat-lbl { font-size: 12px; font-weight: 700; color: #475569; margin-top: 2px; }
.aud-stat-hint { font-size: 10.5px; color: #94a3b8; margin-top: 4px; }
.aud-stat.is-transfer { border-left-color: #2563eb; }
.aud-stat.is-reativ { border-left-color: #0f766e; }
.aud-stat.is-consulta { border-left-color: #7c3aed; }
.aud-stat.is-total { border-left-color: #0f172a; }
.aud-stat.is-users { border-left-color: #d97706; }
.aud-stat.is-os { border-left-color: #0891b2; }
.aud-stat.is-os-alert { border-left-color: #dc2626; }
.aud-stat.is-os-alert .aud-stat-num { color: #b91c1c; }
.aud-stat.is-os-reativ { border-left-color: #7c3aed; }

/* Cards clicáveis de "Ações no período" + painel de detalhe expandido */
.aud-stat.is-clickable {
  cursor: pointer;
  transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}
.aud-stat.is-clickable:hover {
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
  transform: translateY(-1px);
}
.aud-stat.is-clickable:focus-visible {
  outline: 2px solid var(--color-primary, #2563eb);
  outline-offset: 2px;
}
.aud-stat-chevron { font-size: 9px; color: #94a3b8; transition: transform .2s ease; }
.aud-stat.is-aberto { box-shadow: 0 4px 14px rgba(15, 23, 42, 0.14); }
.aud-stat.is-aberto .aud-stat-chevron { transform: rotate(180deg); color: var(--color-primary, #2563eb); }

.aud-card-detalhe {
  margin-top: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
}
.aud-card-loading, .aud-card-erro {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: #64748b; padding: 8px 0;
}
.aud-card-erro { color: #b91c1c; }
.aud-card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
  padding-bottom: 10px; margin-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
}
.aud-card-titulo { font-size: 14px; font-weight: 800; color: #0f172a; display: inline-flex; align-items: center; gap: 8px; }
.aud-card-titulo i { color: var(--color-primary, #2563eb); }
.aud-card-total { font-size: 12px; font-weight: 700; color: #64748b; }
.aud-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.aud-card-sec-full { grid-column: 1 / -1; }
.aud-card-sec-tit {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  color: #475569; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.aud-card-sec-tit i { color: #94a3b8; font-size: 11px; }
.aud-card-sec-tit small { font-weight: 600; text-transform: none; letter-spacing: 0; color: #94a3b8; }
.aud-card-vazio { font-size: 12px; color: #94a3b8; font-style: italic; padding: 4px 0; }

.aud-card-barras { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow-y: auto; }
.aud-card-barras li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px auto;
  align-items: center; gap: 8px;
  padding: 4px 0;
}
.aud-cb-rotulo {
  font-size: 12px; color: #1e293b; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.aud-cb-rotulo small { display: block; font-weight: 500; color: #94a3b8; font-size: 10px; }
.aud-cb-track { height: 8px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.aud-cb-fill { display: block; height: 100%; background: var(--color-primary, #2563eb); border-radius: 999px; }
.aud-cb-qtd { font-size: 12px; font-weight: 800; color: #0f172a; text-align: right; min-width: 28px; }

.aud-card-timeline {
  display: flex; align-items: flex-end; gap: 3px;
  height: 120px; padding-top: 6px; overflow-x: auto;
}
.aud-tl-col {
  flex: 1 0 14px; min-width: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  height: 100%;
}
.aud-tl-bar {
  width: 100%; max-width: 22px; min-height: 4px;
  background: var(--color-primary, #2563eb); border-radius: 4px 4px 0 0;
  transition: background .15s ease;
}
.aud-tl-col:hover .aud-tl-bar { background: #1d4ed8; }
.aud-tl-lbl {
  font-size: 9px; color: #94a3b8; margin-top: 4px;
  white-space: nowrap; transform: rotate(-45deg); transform-origin: center; height: 14px;
}

/* Botão "Listar" + lista de OSs de cupom em aberto */
.aud-listar-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid #0891b2;
  background: #ecfeff;
  color: #0e7490;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
}
.aud-listar-btn:hover { background: #cffafe; }
.aud-os-lista { margin-top: 12px; overflow-x: auto; }
.aud-os-loading, .aud-os-vazio { padding: 14px; text-align: center; color: #64748b; font-size: 13px; }
.aud-os-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.aud-os-table thead th {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #64748b;
  padding: 6px 8px;
  border-bottom: 1px solid #e2e8f0;
}
.aud-os-table tbody td { padding: 7px 8px; border-bottom: 1px solid #eef2f7; vertical-align: top; }
.aud-os-table tbody tr:last-child td { border-bottom: none; }
.aud-os-tit { font-weight: 600; color: #0f172a; }
.aud-os-status {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
}
.aud-os-status.st-1 { background: #fee2e2; color: #b91c1c; }
.aud-os-status.st-2 { background: #fef3c7; color: #92400e; }
.aud-os-status.st-3 { background: #dcfce7; color: #166534; }

/* Botão "Detalhe" por OS na lista do dashboard */
.aud-os-acao { text-align: right; white-space: nowrap; }
.aud-os-detalhe-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #2563eb;
  padding: 3px 10px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.aud-os-detalhe-btn:hover { background: #eff6ff; border-color: #93c5fd; }

/* Modal "Resumo da OS" */
.os-detalhe-modal { max-width: 720px; }
.os-det-body { font-size: 13px; color: #0f172a; }
.os-det-head { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.os-det-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: #eef2f7;
  color: #334155;
  font-size: 11px;
  font-weight: 700;
}
.os-det-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 22px;
}
.os-det-row { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.os-det-row-full { grid-column: 1 / -1; }
.os-det-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #64748b;
  font-weight: 700;
}
.os-det-value { color: #0f172a; word-break: break-word; }
.os-det-value.os-det-pre { white-space: pre-wrap; }
@media (max-width: 600px) {
  .os-det-grid { grid-template-columns: 1fr; }
}

.aud-tops {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}
.aud-top {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
}
.aud-top-titulo {
  font-size: 12px;
  font-weight: 800;
  color: #334155;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.aud-top-titulo i { color: var(--color-primary); font-size: 11px; }
.aud-top-list { list-style: none; margin: 0; padding: 0; }
.aud-top-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 12.5px;
}
.aud-top-list li:last-child { border-bottom: none; }
.aud-rank {
  flex: 0 0 20px;
  height: 20px;
  border-radius: 50%;
  background: #eef2ff;
  color: #4338ca;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.aud-top-nome {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  color: #0f172a;
  font-weight: 600;
  min-width: 0;
}
.aud-top-nome small { font-weight: 500; color: #94a3b8; font-size: 10.5px; }
.aud-qtd { font-weight: 800; color: var(--color-primary); }
.aud-top-vazio { color: #94a3b8; font-style: italic; justify-content: center; }

/* ===== Contas internas do atendimento (card) ===== */
.contas-internas {
  margin-top: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  background: #f8fafc;
}
.contas-titulo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 8px;
}
.contas-titulo i { color: var(--color-primary); }
.contas-titulo span {
  margin-left: auto;
  background: #e2e8f0;
  color: #475569;
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 11px;
}
.contas-table-wrap { overflow-x: auto; }
.contas-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.contas-table thead th {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #64748b;
  padding: 4px 8px;
  border-bottom: 1px solid #e2e8f0;
}
.contas-table tbody td { padding: 7px 8px; border-bottom: 1px solid #eef2f7; }
.contas-table tbody tr:last-child td { border-bottom: none; }
.contas-table tbody tr.conta-cancelada td:first-child,
.contas-table tbody tr.conta-estornada td:first-child { color: #94a3b8; }

.conta-status {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
}
.conta-status.conta-cancelada { background: #fee2e2; color: #b91c1c; }
.conta-status.conta-estornada { background: #fef3c7; color: #92400e; }
.conta-status.conta-definitiva-nf { background: #dbeafe; color: #1e40af; }
.conta-status.conta-definitiva { background: #e0e7ff; color: #3730a3; }
.conta-status.conta-provisoria { background: #e2e8f0; color: #475569; }

.conta-selo {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  margin-right: 3px;
}
.conta-selo.nf { background: #dbeafe; color: #1e40af; }
.conta-selo.titulo { background: #ede9fe; color: #6d28d9; }
.conta-selo.cupom { background: #dcfce7; color: #166534; }
.conta-selo.none { background: transparent; color: #cbd5e1; font-weight: 500; }

.conta-cupom-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: #dcfce7;
  color: #166534;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: .02em;
}
.contas-table td small { color: #64748b; font-weight: 600; }

.contas-aviso {
  margin-top: 10px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
}
.contas-aviso i { margin-top: 2px; }
.contas-aviso.bloqueio { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.contas-aviso.ok { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* ===== Perfil do paciente (conveniado/particular, titular/dependente) ===== */
.perfil-badges { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.perfil-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
}
.perfil-badge.conv { background: #dbeafe; color: #1e40af; }
.perfil-badge.part { background: #f1f5f9; color: #475569; }
.perfil-badge.tit { background: #ede9fe; color: #6d28d9; }
.perfil-badge.dep { background: #dcfce7; color: #166534; }
.perfil-plano { font-size: 11px; color: #64748b; font-weight: 600; }
.perfil-titular { margin-top: 4px; font-size: 12px; color: #475569; }
.perfil-titular-link { color: var(--color-primary); font-weight: 700; text-decoration: none; }
.perfil-titular-link:hover { text-decoration: underline; }

/* Cabeçalho de origem no wizard de transferência */
.transfer-origem-head { font-size: 13px; color: #0f172a; }
.transfer-origem-meta { color: #64748b; font-size: 11.5px; font-weight: 500; }
.transfer-origem-perfil { margin-top: 6px; }
.transfer-confirm-note {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  font-size: 11.5px;
  display: flex;
  gap: 6px;
  align-items: flex-start;
}
