/* ClientePro — ajustes sobre CoreUI (mobile-first) */

/* Callout com acento primário (evita o azul padrão do Bootstrap alert-info) */
.cp-callout {
  padding: 1rem 1.25rem;
  border-radius: var(--cui-border-radius, 0.375rem);
}

.cp-callout-primary {
  --cp-callout-accent: var(--cui-primary, #5856d6);
  background-color: color-mix(in srgb, var(--cp-callout-accent) 9%, var(--cui-body-bg, #fff));
  border: 1px solid color-mix(in srgb, var(--cp-callout-accent) 26%, transparent);
  color: var(--cui-body-color, inherit);
}

[data-coreui-theme="dark"] .cp-callout-primary {
  background-color: color-mix(in srgb, var(--cp-callout-accent) 14%, var(--cui-body-bg, #1e1e1e));
  border-color: color-mix(in srgb, var(--cp-callout-accent) 34%, transparent);
}

.cp-callout-primary__title {
  color: var(--cp-callout-accent);
  font-weight: 600;
}

/* Flash (TempData): fechar visível, um pouco menor, centrado na altura do alerta */
.alert-dismissible .cp-alert-close {
  opacity: 0.92;
  top: 50%;
  right: 0.65rem;
  bottom: auto;
  transform: translateY(-50%);
  padding: 0.35rem;
  width: 0.85em;
  height: 0.85em;
  background-size: 0.85rem 0.85rem;
  background-position: center;
}

.alert-dismissible .cp-alert-close:hover,
.alert-dismissible .cp-alert-close:focus {
  opacity: 1;
  transform: translateY(-50%);
}

[data-coreui-theme="dark"] .alert-success .cp-alert-close {
  filter: brightness(0) invert(1);
  opacity: 0.88;
}

[data-coreui-theme="dark"] .alert-success .cp-alert-close:hover,
[data-coreui-theme="dark"] .alert-success .cp-alert-close:focus {
  opacity: 1;
  transform: translateY(-50%);
}

[data-coreui-theme="dark"] .alert-danger .cp-alert-close {
  opacity: 0.92;
}

[data-coreui-theme="dark"] .alert-danger .cp-alert-close:hover,
[data-coreui-theme="dark"] .alert-danger .cp-alert-close:focus {
  transform: translateY(-50%);
}

body {
  margin-bottom: 0;
}

/* asp-validation-summary / jQuery Unobtrusive: sem isto, o container segue com classes alert-danger e aparece faixa vermelha vazia quando válido */
.validation-summary-valid {
  display: none !important;
}

/* Placeholder de mensagem por campo: fica vazio quando não há erro */
span.field-validation-valid {
  display: none;
}

/* Respiro antes do rodapé em telas com sidebar (empresa + admin): paginação e grids não colam no footer */
:root {
  --cp-main-content-bottom-pad: 1.75rem;
}

.wrapper.min-vh-100 > .body.flex-grow-1 {
  padding-bottom: var(--cp-main-content-bottom-pad);
}

/* Menu lateral — títulos de grupo legíveis em pt-BR */
.sidebar-nav-grouped .nav-title {
  text-transform: none;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  opacity: 0.85;
}

/* Tabelas e cartões nas telas internas */
.table-responsive {
  border-radius: var(--cui-border-radius, 0.375rem);
}

/* Links de ação em linhas — não quebrar layout no mobile */
@media (max-width: 575.98px) {
  .table .btn-sm {
    padding: 0.25rem 0.4rem;
    font-size: 0.75rem;
  }
}

/* Painel — gráficos Chart.js */
.dashboard-chart-wrap {
  position: relative;
  min-height: 280px;
}

.dashboard-chart-wrap--pie {
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
}

/* HTML rico salvo no cadastro do cliente (sanitizado) */
.cliente-informacoes-html {
  overflow-x: auto;
}
.cliente-informacoes-html table {
  max-width: 100%;
}
.cliente-informacoes-html img {
  max-width: 100%;
  height: auto;
}

/* Tabelas de listagem — cabeçalho fixo leve, ordenação, bordas entre colunas */
.table-data-modern {
  --table-data-col-border: var(--bs-border-color, var(--cui-border-color, rgba(0, 0, 0, 0.12)));
}

.table-data-modern thead th {
  white-space: nowrap;
  vertical-align: middle;
  border-bottom-width: 1px;
}

.table-data-modern thead th:not(:first-child),
.table-data-modern tbody td:not(:first-child) {
  border-left: 1px solid var(--table-data-col-border);
}

.table-data-modern thead th.table-sortable a:hover {
  color: var(--cui-primary, #5856d6) !important;
}

.table-data-modern tbody td {
  vertical-align: middle;
}

/* Listagens (admin + tenant): fundo/borda por tema — evita bg-white / table-light (texto claro sobre cabeçalho claro no tema escuro) */
.cp-admin-table-shell,
.cp-data-table-shell {
  background-color: var(--cui-body-bg, #fff);
  border: 1px solid var(--cui-border-color, rgba(0, 0, 0, 0.12));
}

[data-coreui-theme="dark"] .cp-admin-table-shell,
[data-coreui-theme="dark"] .cp-data-table-shell {
  border-color: var(--cui-border-color, rgba(255, 255, 255, 0.12));
}

[data-coreui-theme="dark"] .table-data-modern {
  --table-data-col-border: rgba(255, 255, 255, 0.12);
}

.cp-admin-thead th,
.cp-data-table-thead th {
  background-color: var(--cui-tertiary-bg, #f0f4f8);
  color: var(--cui-body-color);
  border-color: var(--cui-border-color);
}

.cp-admin-thead th a,
.cp-data-table-thead th a {
  color: inherit;
}

[data-coreui-theme="dark"] .cp-admin-thead th,
[data-coreui-theme="dark"] .cp-data-table-thead th {
  background-color: var(--cui-tertiary-bg);
  color: var(--cui-body-color);
}

/* Recorrências — filtros em um card (grid no markup) */

.cp-recorrencia-acoes {
  vertical-align: top;
  padding-top: 0.65rem !important;
  padding-bottom: 0.65rem !important;
}

.cp-recorrencia-acoes .btn-group .btn {
  white-space: nowrap;
}

.cp-recorrencia-legenda li {
  margin-bottom: 0.25rem;
}

.cp-recorrencia-legenda li:last-child {
  margin-bottom: 0;
}

/* Listagens tenant/admin — cards no mobile (compartilhado: clientes, serviços, admin empresas) */
.cp-mobile-cards-stack {
  margin-bottom: 0.5rem;
}

.cp-list-card .cp-list-card-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.cp-list-card .cp-list-card-fields {
  line-height: 1.35;
}

/* Formulários de filtro: botões na mesma linha quebram alinhados à direita (mobile) */
.cp-filter-form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
}

/* Ações em cards de listagem (mobile): mesmo alinhamento à direita */
.cp-list-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
}

/* Recorrências — lista em cards no mobile (abaixo de md) */
.cp-recorrencia-mobile-stack {
  margin-bottom: 0.5rem;
}

.cp-recorrencia-card .cp-recorrencia-card-fields {
  line-height: 1.35;
}

.cp-recorrencia-acoes--mobile .btn-group {
  display: flex;
}

.cp-recorrencia-acoes--mobile .btn-group .btn {
  flex: 1 1 0;
  min-width: 0;
}

@media (max-width: 767.98px) {
  .cp-recorrencia-filtros .card-body {
    padding-bottom: 0.75rem;
  }
}

/* Clientes — coluna E-mail só a partir de md; no mobile o e-mail vai abaixo do nome (evita cabeçalho órfão e ações desalinhadas) */
@media (max-width: 767.98px) {
  .cp-clientes-index-table thead th.cp-table-col-email,
  .cp-clientes-index-table tbody td.cp-table-col-email {
    display: none !important;
  }

  .cp-clientes-index-table tbody td.cp-clientes-acoes {
    white-space: normal;
    vertical-align: top;
  }

  .cp-clientes-index-table tbody td.cp-clientes-acoes .btn {
    min-width: 5rem;
  }
}

@media (min-width: 768px) {
  .cp-clientes-index-table tbody td.cp-clientes-acoes {
    white-space: nowrap;
  }
}

/* Histórico — filtros colapsáveis no mobile (lista aparece sem rolar o painel inteiro) */
@media (max-width: 991.98px) {
  .cp-historico-filtros-card .cp-historico-filtros-summary {
    position: sticky;
    /* Abaixo do header fixo do tenant (~3.5rem) + safe area */
    top: calc(3.5rem + env(safe-area-inset-top, 0px));
    z-index: 3;
    background-color: var(--cui-body-bg, #fff);
    box-shadow: 0 1px 0 color-mix(in srgb, var(--cui-border-color, #cbd5e1) 70%, transparent);
  }
}

.cp-historico-filtros-card .cp-historico-filtros-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
  border-bottom: 1px solid var(--cui-border-color, rgba(0, 0, 0, 0.12));
}

.cp-historico-filtros-card .cp-historico-filtros-summary::-webkit-details-marker {
  display: none;
}

.cp-historico-filtros-card .cp-historico-filtros-chevron {
  flex-shrink: 0;
  width: 0.65rem;
  height: 0.65rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-top: -0.2rem;
  opacity: 0.55;
  transition: transform 0.2s ease;
}

.cp-historico-filtros-card .cp-historico-filtros-details[open] .cp-historico-filtros-chevron {
  transform: rotate(225deg);
  margin-top: 0.15rem;
}

@media (min-width: 992px) {
  .cp-historico-filtros-card .cp-historico-filtros-details {
    display: block;
  }

  .cp-historico-filtros-card .cp-historico-filtros-summary {
    display: none !important;
  }

  /* <details> precisa do atributo [open] para o UA exibir o conteúdo; isso é aplicado via JS em viewports grandes. */
  .cp-historico-filtros-card .cp-historico-filtros-details > .cp-historico-filtros-inner {
    display: block !important;
  }
}

/* Formulário cliente — editor HTML (TinyMCE) ocupa toda a largura da área principal */
.cliente-rich-editor-wrap .tox-tinymce {
  width: 100% !important;
  min-height: 280px;
}
.cliente-rich-editor-wrap .tox .tox-edit-area__iframe {
  background-color: var(--cui-body-bg, #fff);
}

/* Plano — pill na sidebar (ao lado de ClientePro) */
.cp-sidebar-header-brand .sidebar-brand {
  line-height: 1.2;
}

/* Com menu recolhido, empilha marca + selo no espaço estreito */
.sidebar.sidebar-narrow .cp-sidebar-header-brand .d-flex.align-items-center.gap-2.min-w-0,
.sidebar.sidebar-narrow-unfoldable:not(:hover) .cp-sidebar-header-brand .d-flex.align-items-center.gap-2.min-w-0 {
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}
.sidebar.sidebar-narrow .cp-sidebar-header-brand > .d-flex.justify-content-between,
.sidebar.sidebar-narrow-unfoldable:not(:hover) .cp-sidebar-header-brand > .d-flex.justify-content-between {
  justify-content: center !important;
}

.cp-sidebar-plan-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  padding: 0.28rem 0.6rem 0.28rem 0.45rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none !important;
  border-radius: 999px;
  line-height: 1.15;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.95) !important;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 4px 14px rgba(0, 0, 0, 0.25);
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease,
    border-color 0.16s ease;
}

.cp-sidebar-plan-pill:hover {
  transform: translateY(-1px);
  color: #fff !important;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.1) inset,
    0 6px 20px rgba(0, 0, 0, 0.35);
}

.cp-sidebar-plan-pill__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px currentColor;
}

.cp-sidebar-plan-pill--free {
  border-color: rgba(52, 211, 153, 0.45);
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.35) 0%, rgba(6, 95, 70, 0.25) 100%);
}
.cp-sidebar-plan-pill--free .cp-sidebar-plan-pill__dot {
  background: #34d399;
  color: #34d399;
}

.cp-sidebar-plan-pill--pro {
  border-color: rgba(165, 180, 252, 0.55);
  background: linear-gradient(145deg, rgba(99, 102, 241, 0.55) 0%, rgba(76, 29, 149, 0.4) 100%);
}
.cp-sidebar-plan-pill--pro .cp-sidebar-plan-pill__dot {
  background: #a5b4fc;
  color: #a5b4fc;
}

.cp-sidebar-plan-pill__text--compact {
  display: none;
}

/* Menu recolhido (ícone só): abrevia o selo */
.sidebar.sidebar-narrow .cp-sidebar-plan-pill__text--full,
.sidebar.sidebar-narrow-unfoldable:not(:hover) .cp-sidebar-plan-pill__text--full {
  display: none;
}
.sidebar.sidebar-narrow .cp-sidebar-plan-pill__text--compact,
.sidebar.sidebar-narrow-unfoldable:not(:hover) .cp-sidebar-plan-pill__text--compact {
  display: inline;
  letter-spacing: 0.08em;
}
.sidebar.sidebar-narrow .cp-sidebar-plan-pill .cp-sidebar-plan-pill__dot,
.sidebar.sidebar-narrow-unfoldable:not(:hover) .cp-sidebar-plan-pill .cp-sidebar-plan-pill__dot {
  display: none;
}
.sidebar.sidebar-narrow .cp-sidebar-plan-pill,
.sidebar.sidebar-narrow-unfoldable:not(:hover) .cp-sidebar-plan-pill {
  padding: 0.25rem 0.4rem;
  min-width: 1.65rem;
  justify-content: center;
}

/* Plano/upgrade (tenant) — alinhado à landing (hero + cards #planos) */
.body .cp-plano-upgrade {
  margin-inline: -0.75rem;
  width: calc(100% + 1.5rem);
  max-width: none;
}

@media (min-width: 992px) {
  .body .cp-plano-upgrade {
    margin-inline: -1.5rem;
    width: calc(100% + 3rem);
  }
}

.cp-plano-upgrade__inner {
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
}

.cp-plano-upgrade__hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #0f172a 0%, #1e3a5f 42%, #0c4a6e 100%);
  color: #fff;
}

.cp-plano-upgrade__hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(ellipse 80% 50% at 20% 40%, rgba(56, 189, 248, 0.15), transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 20%, rgba(167, 139, 250, 0.12), transparent 45%),
    radial-gradient(circle at 90% 80%, rgba(34, 211, 238, 0.08), transparent 35%);
  pointer-events: none;
}

.cp-plano-upgrade__hero > .container {
  position: relative;
  z-index: 1;
}

.cp-plano-upgrade__kicker {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7dd3fc;
}

.cp-plano-upgrade__title {
  font-family: "Outfit", system-ui, -apple-system, sans-serif;
  font-weight: 700;
  letter-spacing: -0.04em;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  line-height: 1.15;
  color: #fff;
}

.cp-plano-upgrade__lead {
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.82);
  max-width: 38rem;
}

.cp-plano-upgrade__status {
  max-width: 42rem;
  padding: 0.85rem 1.1rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.9rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.95);
}

.cp-plano-upgrade__plans-wrap {
  background: var(--cui-tertiary-bg, #f1f5f9);
}

[data-coreui-theme="dark"] .cp-plano-upgrade__plans-wrap {
  background: rgba(148, 163, 184, 0.08);
}

.cp-plano-upgrade__section-title {
  font-family: "Outfit", system-ui, -apple-system, sans-serif;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  color: var(--cui-body-color, #0f172a);
  max-width: 24rem;
}

.cp-plano-upgrade__section-sub {
  color: var(--cui-secondary-color, #64748b);
  max-width: 26rem;
}

.cp-plano-upgrade .cp-lp-plan-card {
  position: relative;
  border-radius: 1rem;
  padding: 2rem;
  height: 100%;
  border: 1px solid var(--cui-border-color, #e2e8f0);
  background: var(--cui-body-bg, #fff);
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.04);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.cp-plano-upgrade .cp-lp-plan-card:hover {
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
}

.cp-plano-upgrade .cp-lp-plan-card--current:not(.cp-lp-plan-card--pro) {
  box-shadow:
    0 0 0 2px var(--cui-primary, #5856d6),
    0 12px 40px rgba(88, 86, 214, 0.12);
}

.cp-plano-upgrade .cp-lp-plan-card--pro {
  border-color: #0f172a;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: #fff;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.35);
}

.cp-plano-upgrade .cp-lp-plan-card--pro:hover {
  box-shadow: 0 20px 56px rgba(15, 23, 42, 0.45);
}

.cp-plano-upgrade .cp-lp-plan-card--pro.cp-lp-plan-card--current {
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.35),
    0 20px 56px rgba(15, 23, 42, 0.45);
}

.cp-plano-upgrade .cp-lp-plan-card--pro .text-body-secondary {
  color: rgba(255, 255, 255, 0.65) !important;
}

.cp-plano-upgrade .cp-lp-plan-card--pro ul {
  color: rgba(255, 255, 255, 0.9);
}

.cp-plano-upgrade .cp-lp-plan-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: rgba(88, 86, 214, 0.12);
  color: var(--cui-primary, #5856d6);
  border: 1px solid rgba(88, 86, 214, 0.25);
}

.cp-plano-upgrade .cp-lp-plan-badge--on-dark {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.28);
}

.cp-plano-upgrade__plan-price {
  font-family: "Outfit", system-ui, -apple-system, sans-serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.cp-plano-upgrade__contact-card {
  position: relative;
  background: var(--cui-body-bg, #fff);
  border: 1px solid var(--cui-border-color-translucent, rgba(0, 0, 0, 0.08));
  border-radius: 1rem;
  padding: 1.75rem 2rem;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.cp-plano-upgrade__contact-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #0ea5e9 0%, #6366f1 50%, #8b5cf6 100%);
}

/* Recorrências — modal edição rápida: header/footer fixos, corpo rolável */
.cp-modal-cliente-rapido .modal-content {
  max-height: min(92vh, 960px);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.cp-modal-cliente-rapido .modal-content > form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  max-height: 100%;
}

.cp-modal-cliente-rapido .modal-header,
.cp-modal-cliente-rapido .modal-footer {
  flex-shrink: 0;
}

.cp-modal-cliente-rapido .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#clienteRapidoModal .cliente-rich-editor-wrap .tox-tinymce {
  min-height: 220px !important;
  height: 260px !important;
}

/* Tema escuro: garantir contraste em títulos/cabeçalhos de relatórios */
[data-coreui-theme="dark"] .card-header,
[data-coreui-theme="dark"] .card-header.bg-white {
  color: var(--cui-body-color, #e5e7eb) !important;
  background-color: var(--cui-tertiary-bg, #1f2937) !important;
  border-color: var(--cui-border-color, rgba(148, 163, 184, 0.35)) !important;
}

/* Tema escuro: contorno dos cards (border-0 some; shadow-sm quase não aparece no fundo escuro) */
[data-coreui-theme="dark"] .card {
  --cp-card-dark-edge: color-mix(in srgb, var(--cui-border-color, #334155) 100%, rgba(255, 255, 255, 0.1));
}

[data-coreui-theme="dark"] .card.border-0 {
  border: 1px solid var(--cp-card-dark-edge) !important;
}

[data-coreui-theme="dark"] .card.shadow-sm {
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.55),
    0 2px 6px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}

/*
  Tema claro: cards de listagem no mobile (border-0 + só sombra deixavam o topo “apagado”).
  Mesma cor e mesma sombra que .cp-tenant-shell .card no mobile — com 1px em todos os lados (topo = base).
*/
html[data-coreui-theme="light"] .cp-mobile-cards-stack .cp-list-card.card.border-0,
html[data-coreui-theme="light"] .cp-recorrencia-mobile-stack .cp-recorrencia-card.card.border-0 {
  border: 1px solid color-mix(in srgb, var(--cui-border-color, #e2e8f0) 85%, transparent) !important;
  box-shadow: 0 6px 22px rgba(15, 23, 42, 0.06) !important;
}

@media (prefers-color-scheme: light) {
  html[data-coreui-theme="auto"] .cp-mobile-cards-stack .cp-list-card.card.border-0,
  html[data-coreui-theme="auto"] .cp-recorrencia-mobile-stack .cp-recorrencia-card.card.border-0 {
    border: 1px solid color-mix(in srgb, var(--cui-border-color, #e2e8f0) 85%, transparent) !important;
    box-shadow: 0 6px 22px rgba(15, 23, 42, 0.06) !important;
  }
}

/* Recorrências — nome do cliente abre modal; reforço visual além do sublinhado */
.cp-recorrencia-cliente-nome-btn.btn-link {
  text-decoration: underline !important;
  text-underline-offset: 0.15em;
}

.cp-recorrencia-cliente-nome-btn.btn-link:hover,
.cp-recorrencia-cliente-nome-btn.btn-link:focus-visible {
  text-decoration: underline !important;
}

.cp-recorrencia-cliente-nome-btn .cp-recorrencia-cliente-nome-icone {
  width: 1rem;
  height: 1rem;
  opacity: 0.85;
  flex-shrink: 0;
}

/* Mobile app-like experience (tenant shell only, sem impacto no desktop) */
@media (max-width: 991.98px) {
  .cp-tenant-shell {
    --cp-mobile-tabbar-height: calc(62px + env(safe-area-inset-bottom, 0px));
    --cp-mobile-side-gap: 0.75rem;
  }

  .cp-tenant-shell .wrapper {
    background: linear-gradient(180deg, var(--cui-body-bg, #f8fafc) 0%, var(--cui-tertiary-bg, #f1f5f9) 100%);
  }

  .cp-tenant-shell .header.header-sticky {
    position: sticky;
    top: 0;
    z-index: 1035;
    backdrop-filter: saturate(130%) blur(12px);
    -webkit-backdrop-filter: saturate(130%) blur(12px);
    background: color-mix(in srgb, var(--cui-body-bg, #fff) 88%, transparent);
  }

  .cp-tenant-shell .header > .container-fluid {
    min-height: 3.5rem;
    padding-top: calc(0.2rem + env(safe-area-inset-top, 0px));
  }

  .cp-tenant-shell .body {
    padding-left: var(--cp-mobile-side-gap) !important;
    padding-right: var(--cp-mobile-side-gap) !important;
    /* !important: vence .wrapper.min-vh-100 > .body.flex-grow-1 (respiro global) e mantém tab bar */
    padding-bottom: calc(var(--cp-mobile-tabbar-height) + var(--cp-main-content-bottom-pad)) !important;
  }

  /* FAB WhatsApp: reserva altura no fim da rolagem (formulários com Salvar à direita) */
  .cp-tenant-shell.cp-tenant-shell--whatsapp .body,
  .cp-tenant-shell:has(.cp-whatsapp-fab) .body {
    padding-bottom: calc(var(--cp-mobile-tabbar-height) + var(--cp-main-content-bottom-pad) + 56px + 1.25rem + 0.75rem) !important;
  }

  .cp-tenant-shell .body .container,
  .cp-tenant-shell .body .container-lg,
  .cp-tenant-shell .body [class*="container-"] {
    --cui-gutter-x: 0.85rem;
  }

  .cp-tenant-shell .card {
    border-radius: 1rem;
    border-color: color-mix(in srgb, var(--cui-border-color, #e2e8f0) 85%, transparent);
    box-shadow: 0 6px 22px rgba(15, 23, 42, 0.06);
  }

  [data-coreui-theme="dark"] .cp-tenant-shell .card {
    border: 1px solid color-mix(in srgb, var(--cui-border-color, #334155) 100%, rgba(255, 255, 255, 0.1)) !important;
    box-shadow:
      0 8px 28px rgba(0, 0, 0, 0.55),
      0 2px 8px rgba(0, 0, 0, 0.4),
      inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
  }

  .cp-tenant-shell .btn {
    border-radius: 0.75rem;
  }

  .cp-tenant-shell .form-control,
  .cp-tenant-shell .form-select,
  .cp-tenant-shell .input-group-text {
    min-height: 2.7rem;
    border-radius: 0.75rem;
  }

  .cp-tenant-shell .table-responsive {
    border-radius: 0.95rem;
    background: var(--cui-body-bg, #fff);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
  }

  .cp-tenant-shell .footer {
    display: none;
  }

  .cp-tenant-shell .sidebar.sidebar-fixed {
    --cui-sidebar-width: min(86vw, 320px);
    /* Sem spread 100vmax: em tema claro parecia “filtro cinza” em toda a home (sombra cobria a viewport). */
    box-shadow: 0 18px 44px rgba(2, 6, 23, 0.35);
  }

  .cp-mobile-tabbar {
    position: fixed;
    left: 0.7rem;
    right: 0.7rem;
    bottom: max(0.55rem, env(safe-area-inset-bottom, 0px));
    z-index: 1042;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.2rem;
    padding: 0.4rem;
    border-radius: 1rem;
    border: 1px solid color-mix(in srgb, var(--cui-border-color, #cbd5e1) 85%, transparent);
    background: color-mix(in srgb, var(--cui-body-bg, #fff) 90%, transparent);
    backdrop-filter: blur(14px) saturate(130%);
    -webkit-backdrop-filter: blur(14px) saturate(130%);
    box-shadow: 0 12px 30px rgba(2, 6, 23, 0.18);
  }

  .cp-mobile-tabbar__item {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.12rem;
    min-height: 3rem;
    border-radius: 0.75rem;
    text-decoration: none;
    color: var(--cui-secondary-color, #64748b);
    font-size: 0.67rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
  }

  .cp-mobile-tabbar__icon {
    width: 1.1rem;
    height: 1.1rem;
  }

  .cp-mobile-tabbar__item.active {
    color: var(--cui-primary, #5856d6);
    background: color-mix(in srgb, var(--cui-primary, #5856d6) 14%, transparent);
  }

  .cp-mobile-tabbar__item:active {
    transform: translateY(1px);
  }
}

/* Formulário — bolinha “i” (contorno primário) + tooltip Bootstrap à direita (hover/foco) */
.cp-field-help-btn {
  --cp-field-help-fg: var(--cui-primary, #5856d6);
  --cp-field-help-size: 1.25rem;
  width: var(--cp-field-help-size);
  height: var(--cp-field-help-size);
  min-width: var(--cp-field-help-size);
  padding: 0 !important;
  line-height: 1;
  vertical-align: middle;
  text-decoration: none !important;
  color: var(--cp-field-help-fg) !important;
  background-color: transparent !important;
  border: 1.5px solid var(--cp-field-help-fg) !important;
  box-sizing: border-box;
}

.cp-field-help-btn:hover {
  filter: none;
  color: var(--cp-field-help-fg) !important;
  background-color: color-mix(in srgb, var(--cp-field-help-fg) 12%, transparent) !important;
}

.cp-field-help-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cp-field-help-fg) 32%, transparent) !important;
}

.cp-field-help-i {
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1;
  font-style: italic;
  user-select: none;
  color: inherit;
}

/* Texto longo no tooltip (Bootstrap injeta .tooltip) */
.tooltip.cp-field-help-tooltip .tooltip-inner {
  max-width: min(22rem, calc(100vw - 2rem));
  text-align: left;
  padding: 0.5rem 0.65rem;
  font-size: 0.8125rem;
  line-height: 1.35;
}

/* WhatsApp FAB (tenant) */
.cp-whatsapp-fab {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1045;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none !important;
  color: #fff !important;
  background: #25D366;
  box-shadow: 0 14px 28px rgba(2, 6, 23, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.cp-whatsapp-fab:hover {
  filter: brightness(1.03);
  box-shadow: 0 18px 36px rgba(2, 6, 23, 0.28);
  transform: translateY(-1px);
}

.cp-whatsapp-fab:active {
  transform: translateY(1px);
}

.cp-whatsapp-fab__icon {
  width: 28px;
  height: 28px;
}

@media (max-width: 991.98px) {
  /* Acima da tab bar; à esquerda para não sobrepor botões “Salvar” / ações alinhadas à direita */
  .cp-tenant-shell .cp-whatsapp-fab {
    left: max(1rem, env(safe-area-inset-left, 0px));
    right: auto;
    bottom: calc(var(--cp-mobile-tabbar-height, 62px) + 1rem);
  }
}
