@charset "UTF-8";

/* ==========================================================================
   Painel Bot WhatsApp — camada de design sobre o Tabler (v1.2.0)
   Direção: painel de operação consultado no celular, entre conversas.
   Assinatura visual: "o sinal" — o estado da conexão visível em qualquer
   tela (barra do topo, ponto pulsante, aba inferior, borda dos cards).
   Fontes vendorizadas em /fonts (o CSP exige font-src 'self').
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Fontes (subset latin, variáveis)
   -------------------------------------------------------------------------- */
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/fonts/space-grotesk-latin-wght-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2");
}

/* --------------------------------------------------------------------------
   2. Tokens
   -------------------------------------------------------------------------- */
:root {
  /* paleta: tinta grafite-petróleo + verde de sinal, usado com contenção */
  --app-ink: #16262e;
  --app-petrol: #2f5f6d;
  --app-petrol-soft: #eaf1f3;
  --app-paper: #f2f5f6;
  --app-line: #dfe5e8;
  --app-signal-ok: #17a45c;
  --app-signal-warn: #e0a20b;
  --app-signal-off: #d63939;
  --app-signal-idle: #93a2ab;

  --app-font-display: "Space Grotesk", "Inter", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, sans-serif;
  --app-font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", sans-serif;

  --app-navbar-h: 3.5rem;
  --app-tabbar-h: 3.75rem;

  /* sobreposição do Tabler */
  --tblr-primary: var(--app-petrol);
  --tblr-primary-rgb: 47, 95, 109;
  --tblr-primary-darken: #264f5b;
  --tblr-primary-lt: #eaf1f3;
  --tblr-primary-lt-rgb: 234, 241, 243;
  --tblr-body-bg: var(--app-paper);
  --tblr-body-color: var(--app-ink);
  --tblr-font-sans-serif: var(--app-font-body);
  --tblr-border-radius: 0.625rem;
  --tblr-card-border-color: var(--app-line);
  --tblr-border-color: var(--app-line);
}

html[data-bs-theme="dark"] {
  --app-ink: #e4edf1;
  --app-petrol: #57a2b4;
  --app-petrol-soft: #1a2c34;
  --app-paper: #0e1a20;
  --app-line: #23363f;
  --tblr-primary: #57a2b4;
  --tblr-primary-rgb: 87, 162, 180;
  --tblr-primary-darken: #4a8d9d;
  --tblr-primary-lt: #1a2c34;
  --tblr-primary-lt-rgb: 26, 44, 52;
  --tblr-body-bg: var(--app-paper);
  --tblr-body-color: var(--app-ink);
  --tblr-card-bg: #14232a;
  --tblr-card-border-color: var(--app-line);
  --tblr-border-color: var(--app-line);
  --tblr-bg-surface: #14232a;
  --tblr-link-color: var(--app-petrol);
}

/* --------------------------------------------------------------------------
   3. Base
   -------------------------------------------------------------------------- */
body {
  font-family: var(--app-font-body);
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

.navbar-brand,
.page-title,
.card-title,
.app-display,
.h1, .h2, .h3, h1, h2, h3 {
  font-family: var(--app-font-display);
  letter-spacing: -0.015em;
}

a {
  text-underline-offset: 0.15em;
}

/* números alinhados (tabelas, contadores) */
table, .stats-value, .subheader, .badge {
  font-variant-numeric: tabular-nums;
}

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  z-index: 2000;
  padding: 0.5rem 0.875rem;
  border-radius: 0 0 var(--tblr-border-radius) var(--tblr-border-radius);
  background: #16262e;
  color: #fff;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 0;
  color: #fff;
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--app-petrol);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   4. Barra do topo (horizontal, fixa)
   -------------------------------------------------------------------------- */
.app-navbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  min-height: var(--app-navbar-h);
  padding: 0;
  background: var(--tblr-bg-surface);
  border-bottom: 1px solid var(--app-line);
  transition: box-shadow 0.18s ease;
}

html.app-scrolled .app-navbar {
  box-shadow: 0 6px 18px -14px rgba(15, 30, 38, 0.7);
}

.app-navbar .container-xl {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--app-navbar-h);
  padding-left: 0.5rem;
  padding-right: 0.75rem;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
  margin: 0 0 0 -0.125rem;
  padding: 0.2rem 0.25rem 0.2rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.app-brand:hover {
  color: inherit;
}

.app-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  border-radius: 0.6rem;
  background: linear-gradient(150deg, #2f5f6d, #16262e);
  color: #fff;
  font-size: 1.125rem;
}

.app-brand-name {
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--app-font-display);
  letter-spacing: -0.02em;
  line-height: 1;
}

.app-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1;
  gap: 0.05rem;
}

.app-brand-sub {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tblr-secondary);
  opacity: 0.9;
}

/* --- navegação principal ------------------------------------------------- */
.app-nav-scroll {
  flex: 1 1 auto;
  min-width: 0;
  margin-left: 0.375rem;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.app-nav-scroll::-webkit-scrollbar {
  display: none;
}

.app-nav {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.125rem;
  margin: 0;
  padding: 0;
  list-style: none;
  white-space: nowrap;
}

.app-nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4375rem;
  padding: 0.4375rem 0.6875rem;
  border-radius: 999px;
  color: var(--tblr-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.app-nav-link i.ti {
  font-size: 1.0625rem;
  line-height: 1;
}

.app-nav-link:hover {
  color: var(--app-ink);
  background: var(--app-petrol-soft);
}

.app-nav-link[aria-current="page"] {
  color: var(--app-petrol);
  font-weight: 600;
  background: var(--app-petrol-soft);
}

html:not([data-bs-theme="dark"]) .app-nav-link[aria-current="page"] {
  background: #dfeaee;
}

/* --- agrupador à direita ------------------------------------------------- */
.app-nav-tools {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex: 0 0 auto;
  min-width: 0;
  margin-left: auto;
}

.app-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--tblr-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.app-icon-btn:hover {
  background: var(--app-petrol-soft);
  color: var(--app-ink);
}

.app-menu-btn {
  display: none;
}

/* ícone do tema: mostra só o que corresponde ao tema ativo */
.icon-light {
  display: none;
}

.icon-dark {
  display: inline-block;
}

html[data-bs-theme="dark"] .icon-light {
  display: inline-block;
}

html[data-bs-theme="dark"] .icon-dark {
  display: none;
}

/* --------------------------------------------------------------------------
   5. "O sinal": o estado da conexão sempre visível
   -------------------------------------------------------------------------- */
.app-signal {
  display: inline-flex;
  align-items: center;
  gap: 0.4375rem;
  padding: 0.3125rem 0.6875rem 0.3125rem 0.5625rem;
  border: 1px solid var(--app-line);
  border-radius: 999px;
  background: var(--app-petrol-soft);
  color: var(--app-ink);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  white-space: nowrap;
}

.app-signal:hover {
  border-color: var(--app-petrol);
}

.app-signal-sm {
  margin-top: 0.25rem;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
}

/* variante larga (navbar desktop): comprime antes de invadir o menu */
.app-signal-wide {
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-dot {
  position: relative;
  flex: 0 0 auto;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--app-signal-idle);
}

.app-dot::after {
  content: "";
  position: absolute;
  inset: -0.25rem;
  border-radius: 50%;
  opacity: 0;
}

[data-signal="connected"] .app-dot {
  background: var(--app-petrol);
}

[data-signal="connecting"] .app-dot,
[data-signal="qr"] .app-dot,
[data-signal="unconfirmed"] .app-dot {
  background: var(--app-signal-warn);
}

[data-signal="offline"] .app-dot,
[data-signal="error"] .app-dot {
  background: var(--app-signal-off);
}

[data-signal="connected"] .app-dot::after {
  box-shadow: 0 0 0 2px var(--app-petrol);
  animation: app-pulse 2.6s ease-out infinite;
}

[data-signal="connecting"] .app-dot::after,
[data-signal="qr"] .app-dot::after {
  box-shadow: 0 0 0 2px var(--app-signal-warn);
  animation: app-pulse 1.5s ease-out infinite;
}

@keyframes app-pulse {
  0% {
    opacity: 0.45;
    transform: scale(0.6);
  }
  70% {
    opacity: 0;
    transform: scale(1.6);
  }
  100% {
    opacity: 0;
    transform: scale(1.6);
  }
}

.app-signal-text {
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --------------------------------------------------------------------------
   6. Menu deslizante (celular) + abas inferiores
   -------------------------------------------------------------------------- */
.app-sheet {
  position: fixed;
  inset: 0;
  z-index: 1045;
  display: none;
  pointer-events: none;
}

.app-sheet.is-open {
  display: block;
  pointer-events: auto;
}

.app-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 18, 23, 0.5);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.app-sheet.is-open .app-sheet-backdrop {
  opacity: 1;
}

/* com o menu aberto, só a folha de menu rola */
body.app-menu-open {
  overflow: hidden;
}

.app-sheet-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(20.5rem, 88vw);
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--tblr-bg-surface);
  border-left: 1px solid var(--app-line);
  box-shadow: -18px 0 40px -24px rgba(8, 18, 23, 0.7);
  transform: translateX(100%);
  transition: transform 0.24s cubic-bezier(0.32, 0.72, 0, 1);
}

.app-sheet.is-open .app-sheet-panel {
  transform: translateX(0);
}

.app-sheet-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  background: var(--tblr-bg-surface);
  border-bottom: 1px solid var(--app-line);
}

.app-sheet-user {
  min-width: 0;
  flex: 1 1 auto;
}

.app-sheet-group {
  padding: 0.875rem 0.875rem 0.25rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--tblr-secondary);
}

.app-sheet-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: calc(100% - 1rem);
  margin: 0.0625rem 0.5rem;
  padding: 0.6875rem 0.625rem;
  border: 0;
  border-radius: 0.5rem;
  background: none;
  color: var(--app-ink);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.app-sheet-link:hover {
  background: var(--app-petrol-soft);
}

.app-sheet-link[aria-current="page"] {
  background: var(--app-petrol-soft);
  color: var(--app-petrol);
  font-weight: 600;
}

.app-sheet-link i.ti {
  flex: 0 0 auto;
  width: 1.375rem;
  font-size: 1.25rem;
}

.app-sheet-hint {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--tblr-secondary);
}

.app-sheet-body {
  padding: 0.5rem 0.5rem 0;
}

/* --- abas inferiores ----------------------------------------------------- */
.app-tabbar {
  display: none;
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  z-index: 1035;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--tblr-bg-surface);
  border-top: 1px solid var(--app-line);
}

.app-tabbar-inner {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  align-items: stretch;
  width: 100%;
  max-width: 34rem;
  min-height: var(--app-tabbar-h);
  margin: 0 auto;
  box-sizing: border-box;
}

.app-tab {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1875rem;
  padding: 0.375rem 0.125rem;
  color: var(--tblr-secondary);
  font-size: 0.6875rem;
  font-weight: 600;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.app-tab > span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-tab i.ti {
  position: relative;
  font-size: 1.375rem;
  line-height: 1;
}

.app-tab:hover {
  color: var(--tblr-secondary);
}

.app-tab[aria-current="page"] {
  color: var(--app-petrol);
}

.app-tab-signal {
  position: absolute;
  top: -0.1875rem;
  right: -0.4375rem;
  width: 0.5rem;
  height: 0.5rem;
  border: 1.5px solid var(--tblr-bg-surface);
  border-radius: 50%;
  background: var(--app-signal-idle);
}

[data-signal="connected"] .app-tab-signal {
  background: var(--app-petrol);
}

[data-signal="connecting"] .app-tab-signal,
[data-signal="qr"] .app-tab-signal,
[data-signal="unconfirmed"] .app-tab-signal {
  background: var(--app-signal-warn);
}

[data-signal="offline"] .app-tab-signal,
[data-signal="error"] .app-tab-signal {
  background: var(--app-signal-off);
}

/* --------------------------------------------------------------------------
   7. Corpo da página
   -------------------------------------------------------------------------- */
.page {
  min-height: 100vh;
}

.page-body {
  padding-top: 0;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--tblr-card-bg);
  border: 1px solid var(--app-line);
  border-radius: 0.625rem;
  box-shadow: 0 1px 2px rgba(15, 30, 38, 0.05);
}

.page-header-text {
  flex: 1 1 10rem;
  min-width: 0;
}

.page-title {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.25;
}

.page-header .page-title {
  font-size: 1.125rem;
  letter-spacing: -0.02em;
}

.page-description {
  margin-top: 0.125rem;
  font-size: 0.875rem;
  color: var(--tblr-secondary);
}

.app-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.btn .ti {
  font-size: 1.125rem;
  vertical-align: -0.1875rem;
}

/* --------------------------------------------------------------------------
   8. Cards, métricas, passos
   -------------------------------------------------------------------------- */
.card {
  border-color: var(--app-line);
  box-shadow: 0 1px 2px rgba(15, 30, 38, 0.05);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
}

.subheader {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tblr-secondary);
  margin-bottom: 0.375rem;
}

.stats-value {
  font-family: var(--app-font-display);
  font-size: 1.875rem;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.stats-value-sm {
  font-size: 1.375rem;
}

.app-metric-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5625rem;
  background: var(--app-petrol-soft);
  color: var(--app-petrol);
  font-size: 1.25rem;
}

/* lista numerada compacta (passos de um procedimento real) */
.app-numbered {
  counter-reset: appnum;
  display: grid;
  gap: 0.625rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.app-numbered > li {
  counter-increment: appnum;
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 0.875rem;
}

.app-numbered > li::before {
  content: counter(appnum);
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 50%;
  background: var(--app-petrol-soft);
  color: var(--app-petrol);
  font-family: var(--app-font-display);
  font-size: 0.75rem;
  font-weight: 700;
}

/* passos do checklist: sequência numerada, numerada de verdade */
.app-steps {
  counter-reset: app-step;
  display: grid;
  gap: 0.625rem;
}

@media (min-width: 576px) {
  .app-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.app-step {
  counter-increment: app-step;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--app-line);
  border-radius: 0.625rem;
  background: var(--tblr-bg-surface);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.app-step:hover {
  color: inherit;
  text-decoration: none;
  border-color: var(--app-petrol);
  box-shadow: 0 8px 20px -16px rgba(15, 30, 38, 0.9);
}

.app-step::before {
  content: counter(app-step);
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.625rem;
  height: 1.625rem;
  border-radius: 50%;
  background: #16262e;
  color: #fff;
  font-family: var(--app-font-display);
  font-size: 0.8125rem;
  font-weight: 600;
}

html[data-bs-theme="dark"] .app-step::before {
  background: #dfeaee;
  color: #14232a;
}

.app-step.is-done {
  border-color: rgba(23, 164, 92, 0.4);
}

.app-step.is-done::before {
  content: "\ea67";
  font-family: "tabler-icons" !important;
  font-size: 1.125rem;
  background: var(--app-signal-ok);
  color: #fff;
}

.app-step-title {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
}

.app-step-desc {
  font-size: 0.8125rem;
  color: var(--tblr-secondary);
}

/* --------------------------------------------------------------------------
   9. Badges e chips de etiqueta
   -------------------------------------------------------------------------- */
.badge {
  padding: 0.25em 0.625em;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.badge i.ti {
  font-size: 0.9375rem;
  vertical-align: -0.125em;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0 0.25rem 0.25rem 0;
  padding: 0.125rem 0.5rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: transparent;
}

/* --------------------------------------------------------------------------
   10. Tabelas → cartões empilhados no celular
   -------------------------------------------------------------------------- */
.table {
  font-size: 0.875rem;
}

.table thead th {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tblr-secondary);
  background: transparent;
  white-space: nowrap;
}

.table td,
.table th {
  border-color: var(--app-line);
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.card-table > tbody > tr:first-child > * {
  border-top: 0;
}

@media (max-width: 767.98px) {
  .table-stack,
  .table-stack > tbody,
  .table-stack > tbody > tr,
  .table-stack > tbody > tr > td {
    display: block;
    width: 100%;
  }

  .table-stack > thead {
    display: none;
  }

  .table-stack > tbody > tr {
    margin-bottom: 0.625rem;
    padding: 0.75rem;
    border: 1px solid var(--app-line);
    border-radius: 0.625rem;
    background: var(--tblr-bg-surface);
  }

  .table-stack > tbody > tr > td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.875rem;
    padding: 0.25rem 0;
    border: 0;
    text-align: right;
    white-space: normal;
    word-break: break-word;
  }

  .table-stack > tbody > tr > td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--tblr-secondary);
    text-align: left;
  }

  .table-stack > tbody > tr > td[data-label=""]::before,
  .table-stack > tbody > tr > td.app-no-label::before {
    content: none;
  }

  .table-stack > tbody > tr > td.app-cell-lead {
    padding: 0 0 0.5rem;
    font-size: 1rem;
    text-align: left;
    justify-content: flex-start;
  }

  .table-stack > tbody > tr > td.app-cell-actions {
    margin-top: 0.5rem;
    padding-top: 0.625rem;
    border-top: 1px dashed var(--app-line);
    justify-content: flex-end;
    gap: 0.375rem;
  }
}

/* --------------------------------------------------------------------------
   11. Formulários
   -------------------------------------------------------------------------- */
.form-label {
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.form-control,
.form-select {
  border-color: var(--app-line);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--app-petrol);
  box-shadow: 0 0 0 3px rgba(47, 95, 109, 0.18);
}

html[data-bs-theme="dark"] .form-control:focus,
html[data-bs-theme="dark"] .form-select:focus {
  box-shadow: 0 0 0 3px rgba(87, 162, 180, 0.22);
}

.form-hint {
  font-size: 0.8125rem;
  line-height: 1.45;
}

.card-footer {
  background: transparent;
  border-color: var(--app-line);
}

@media (max-width: 767.98px) {
  /* navegadores dão zoom em campos com fonte menor que 16px */
  .form-control,
  .form-select,
  textarea.form-control {
    font-size: 16px;
  }

  .app-sticky-footer {
    position: sticky;
    bottom: 0;
    z-index: 6;
    display: flex;
    gap: 0.5rem;
    margin: 0 0 -1rem;
    padding: 0.625rem 1rem calc(0.625rem + env(safe-area-inset-bottom));
    background: var(--tblr-bg-surface);
    border-top: 1px solid var(--app-line);
    box-shadow: 0 -8px 20px -18px rgba(15, 30, 38, 0.95);
  }

  .app-sticky-footer .btn {
    flex: 1 1 auto;
  }
}

/* --------------------------------------------------------------------------
   12. Estados vazios, alertas, QR Code
   -------------------------------------------------------------------------- */
.empty {
  padding: 2.5rem 1rem;
}

.empty .empty-img .ti {
  font-size: 2.5rem;
  color: var(--tblr-secondary);
}

.empty .empty-header {
  font-family: var(--app-font-display);
}

.empty-title {
  font-family: var(--app-font-display);
  font-weight: 600;
}

.empty-action {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.empty-action .btn {
  flex: 0 1 auto;
}

#qr-image {
  image-rendering: pixelated;
  width: min(19rem, 74vw);
  height: auto;
}

.qr-skeleton {
  width: min(15rem, 66vw);
  height: min(15rem, 66vw);
  margin: 0 auto;
  border-radius: 0.75rem;
  background: linear-gradient(90deg, #eef1f4 25%, #e2e8f0 50%, #eef1f4 75%);
  background-size: 200% 100%;
  animation: app-shimmer 1.2s infinite;
}

html[data-bs-theme="dark"] .qr-skeleton {
  background: linear-gradient(90deg, #1a2c34 25%, #23363f 50%, #1a2c34 75%);
  background-size: 200% 100%;
}

@keyframes app-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.alert {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  border-radius: 0.625rem;
  font-size: 0.875rem;
}

.alert .ti {
  vertical-align: -0.125rem;
}

/* divisão da página de conexão: borda inferior no mobile, lateral no desktop */
.connection-split-left {
  border-bottom: 1px solid var(--app-line);
}

@media (min-width: 992px) {
  .connection-split-left {
    border-bottom: 0;
    border-right: 1px solid var(--app-line);
  }
}

/* tamanho de ícone-destaque (o .icon-lg do Tabler 1.2 não escala a fonte) */
.icon-xl {
  font-size: 2.5rem;
  line-height: 1;
}

.icon-2xl {
  font-size: 3.5rem;
  line-height: 1;
}

/* ícone girando (estado transitório) */
.app-spin {
  display: inline-block;
  animation: app-rotate 1.6s linear infinite;
}

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

/* --------------------------------------------------------------------------
   13. Telas isoladas (entrada e erro)
   -------------------------------------------------------------------------- */
.app-auth {
  border-top: 3px solid var(--app-petrol);
}

.app-auth-mark {
  width: 3.25rem;
  height: 3.25rem;
  margin: 0 auto 0.75rem;
  border-radius: 1rem;
  font-size: 1.75rem;
}

.app-auth-title {
  font-family: var(--app-font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.app-error-code {
  font-family: var(--app-font-display);
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--app-petrol);
}

/* --------------------------------------------------------------------------
   14. Utilitários próprios
   -------------------------------------------------------------------------- */
.min-w-0 {
  min-width: 0;
}

.text-truncate-cell {
  max-width: 15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mw-20 {
  max-width: 20rem;
}

.mw-26 {
  max-width: 26rem;
}

.mw-45 {
  max-width: 28rem;
}

.progress-bar {
  transition: width 0.35s ease;
}

/* Tabler 1.2 não traz .progress-lg nem .rows: definidos aqui */
.progress-lg {
  height: 0.75rem;
  border-radius: 999px;
}

.progress-lg .progress-bar {
  border-radius: 999px;
}

dl.rows {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  margin: 0;
}

dl.rows > dt,
dl.rows > dd {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--app-line);
  margin: 0;
}

dl.rows > dt {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--tblr-secondary);
}

dl.rows > dd {
  font-weight: 500;
  overflow-wrap: anywhere;
}

dl.rows > dt:nth-last-of-type(1),
dl.rows > dd:nth-last-of-type(1) {
  border-bottom: 0;
}

/* as colunas do grid já cuidam da largura */
dl.rows > .col-6,
dl.rows > .col-5,
dl.rows > .col-7 {
  width: auto;
  flex: none;
}

@media (max-width: 575.98px) {
  dl.rows {
    grid-template-columns: minmax(0, 1fr);
  }

  dl.rows > dt {
    padding-bottom: 0;
    border-bottom: 0;
  }

  dl.rows > dd {
    padding-top: 0.0625rem;
  }
}

/* --------------------------------------------------------------------------
   14. Breakpoints do shell
   -------------------------------------------------------------------------- */
/* até 1366px (notebooks comum) o sinal fica só o ponto pra não invadir o Config */
@media (max-width: 1366px) {
  .app-signal-wide .app-signal-text {
    display: none;
  }

  .app-signal-wide {
    padding: 0.5rem;
    gap: 0;
    min-width: 2rem;
    justify-content: center;
  }
}

/* até 1100px esconde o sinal pra liberar espaço pro menu Config */
@media (max-width: 1100px) {
  .app-signal-wide {
    display: none !important;
  }
}

@media (max-width: 991.98px) {
  .app-nav-scroll,
  .app-signal-wide {
    display: none !important;
  }

  .app-menu-btn {
    display: inline-flex;
  }

  .app-tabbar {
    display: block;
  }

  /* a barra de abas não pode cobrir conteúdo nem rodapé */
  .page-body {
    padding-top: 0;
    padding-bottom: calc(var(--app-tabbar-h) + 1.5rem + env(safe-area-inset-bottom));
  }

  .footer {
    display: none;
  }
}

@media (min-width: 992px) {
  .app-sheet {
    display: none !important;
  }
}

@media (max-width: 575.98px) {
  .container-xl {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .page-title {
    font-size: 1.25rem;
  }

  .stats-value {
    font-size: 1.625rem;
  }

  .page-header {
    align-items: stretch;
  }

  .app-actions {
    width: 100%;
  }

  .app-actions .btn {
    flex: 1 1 auto;
  }
}

/* alvos de toque confortáveis (celular e tablet) */
@media (max-width: 991.98px) {
  .btn,
  .app-sheet-link,
  .app-tab,
  .page-link,
  .nav-link,
  .form-control,
  .form-select {
    min-height: 2.75rem;
  }

  .btn-sm,
  .table .btn,
  .card-actions .btn {
    min-height: 2.5rem;
  }

  .app-icon-btn {
    width: 2.75rem;
    height: 2.75rem;
  }

  /* o controle em si é pequeno: o rótulo é que dá a área de toque */
  .form-switch,
  .form-check {
    padding-top: 0.375rem;
    padding-bottom: 0.375rem;
  }
}

/* --------------------------------------------------------------------------
   15. Movimento reduzido, alto contraste e impressão
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .app-navbar,
  .app-tabbar,
  .app-sheet,
  .footer,
  .btn {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .card {
    box-shadow: none;
    break-inside: avoid;
  }
}

/* --------------------------------------------------------------------------
   14. Cabeçalho amigável das páginas (.pg-*)
   Título + "o que esta tela faz" + dica "Como usar" (details nativo).
   -------------------------------------------------------------------------- */
.pg-head {
  padding: 0.25rem 0 0.1rem;
}

.pg-badge {
  flex: 0 0 auto;
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.9rem;
  background: var(--app-petrol-soft);
  color: var(--app-petrol);
  font-size: 1.35rem;
  border: 1px solid var(--app-line);
}

.pg-title {
  font-family: var(--app-font-display);
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--app-ink);
}

.pg-sub {
  color: var(--tblr-secondary, #627078);
  font-size: 0.925rem;
  line-height: 1.45;
  max-width: 62ch;
}

.pg-help {
  border: 1px solid var(--app-line);
  border-radius: 0.85rem;
  background: var(--app-paper);
  overflow: hidden;
}

.pg-help-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
  padding: 0.55rem 0.9rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--app-petrol);
  user-select: none;
}

.pg-help-summary::-webkit-details-marker {
  display: none;
}

.pg-help-summary .pg-caret {
  transition: transform 0.18s ease;
}

.pg-help[open] .pg-help-summary .pg-caret {
  transform: rotate(180deg);
}

.pg-help-summary:hover {
  background: rgba(47, 95, 109, 0.06);
}

.pg-help-body {
  padding: 0.15rem 0.9rem 0.8rem;
  border-top: 1px solid var(--app-line);
  padding-top: 0.65rem;
  font-size: 0.875rem;
  color: var(--app-ink);
}

.pg-steps {
  padding-left: 1.35rem;
  margin: 0;
  display: grid;
  gap: 0.3rem;
}

.pg-steps li::marker {
  color: var(--app-petrol);
  font-weight: 700;
}

.pg-tip {
  color: var(--tblr-secondary, #627078);
}

[data-bs-theme="dark"] .pg-badge {
  background: rgba(47, 95, 109, 0.35);
  color: #9fd0dc;
  border-color: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="dark"] .pg-help {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="dark"] .pg-help-summary:hover {
  background: rgba(255, 255, 255, 0.05);
}
