/* Variáveis de Cores e Fonte */
:root {
  --pico-font-family-sans-serif: 'Inter', Roboto, Tahoma, Arial, system-ui, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --pico-form-element-spacing-vertical: 0.35rem;
  --pico-form-element-spacing-horizontal: 0.35rem;
  --app-header-bg: #0172ad;
  --pico-font-family: var(--pico-font-family-sans-serif);
}

.turnstile-container {
  margin: 12px 0 6px;
  min-height: 65px;
}

html,
body,
#app {
  background: var(--pico-background-color);
  line-height: 1.6;
}

/* INI Comportamento estilo App Nativo (Mobile)
--------------------------------------*/
body {
  -webkit-touch-callout: none; /* Previne popup ao segurar botões/links no iOS */
  -webkit-user-select: none; /* Chrome/Safari/Opera */
  -moz-user-select: none; /* Firefox */
  -ms-user-select: none; /* IE/Edge */
  user-select: none; /* Padrão */
  -webkit-tap-highlight-color: transparent; /* Remove sombra cinza de toque no mobile */
}

/* Restaura o comportamento normal para campos de formulário */
input, textarea, select {
  -webkit-user-select: auto !important;
  user-select: auto !important;
}


obr {
  color: var(--pico-primary);
  font-weight: normal;
}

acao {
  color: var(--pico-del-color);
  font-weight: bold;
  display: block;
  margin-bottom: 0.7rem;
}

sucesso {
  color: var(--pico-ins-color);
  font-weight: bold;
  display: block;
  margin-bottom: 1.0rem;
}

.titulo2 {
  color: #6366F1;
}

.titulo1 {
  color: #22C55E;
}


/* Previne arrastar links, imagens e vetores (aparência mais firme de app) */
a,
img,
svg {
  -webkit-user-drag: none;
}

/*--------------------------------------
FIM Comportamento estilo App Nativo (Mobile) */

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: max(env(safe-area-inset-top, 0px), 2px);
  background: var(--app-header-bg);
  pointer-events: none;
  z-index: 2000;
}

h1 {
  color: var(--pico-primary);
  margin-bottom: 0.2rem;
  display: inline;
}

h3 {
  color: var(--pico-primary);
  border-bottom: 1px solid var(--pico-muted-border-color);
  /* Linha sutil */
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
  display: block;
  /* Ocupa a largura total para a linha atravessar */
  letter-spacing: -0.02em;
  /* Toque tipográfico elegante */
  font-size: 1.2rem;
  font-weight: var(--pico-font-weight);
}

article {
  padding: 0.6rem 0.6rem 0.6rem 0.6rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  overflow: hidden;
}

article>header h5 {
  margin: 0;
  line-height: 1.15;
}

article>header small {
  display: block;
  margin-top: 0.1rem;
  line-height: 1.15;
}

article>footer {
  padding-top: 0.3rem;
  border-top: 1px dashed var(--pico-muted-border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

/* Área de Conteúdo Principal */
main {
  padding: 0.5rem 0.4rem 0.3rem 0.4rem;
}

/* Estilos globais para botões de ação em listas */
.acoes-mini {
  display: flex;
  gap: 0.25rem;
}

.grid-unidades {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 1.5rem;
}

.grid-unidades button {
  width: 100%;
  padding: 1px 3px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 1000;
  font-size: 1.5rem;
}

.linha {
  display: flex;
  gap: 0.4rem;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.topo {
  display: flex;
  gap: 6rem;
  flex-wrap: nowrap;
}

.linha button {
  flex: 0 0 auto;
  width: auto;
  min-width: 160px;
  padding: 0.5rem 0.9rem;
}

/* NO CELULAR: esconde o texto e deixa só o ícone */
@media (max-width: 768px) {
  /*
  .btn-text {
    display: none;
  }
  */

  .linha button {
    min-width: 110px;
    padding: 0.45rem 0.6rem;
  }
}

.btn-acao {
  padding: 0.4rem;
  display: inline-flex;
  align-items: center;
  margin: 0;
  width: 34px;
  height: 34px;
}

.btn-icon {
  padding-right: 0.6rem !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: var(--pico-muted-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  width: auto !important;
  margin: 0 !important;
}

.btn-icon svg {
  width: 18px !important;
  height: 18px !important;
}

.btn-icon:hover {
  color: var(--pico-primary) !important;
  background: rgba(0, 0, 0, 0.05) !important;
  border-radius: 4px;
}

.btn-delete:hover {
  color: #ef4444 !important;
}

/* Reset para botões dentro de flexbox nos footers de modal */
dialog footer button {
  margin-bottom: 0 !important;
}

.raio {
  border-radius: 0.75rem;
  overflow: hidden;
  /* Garante que o conteúdo não "vaze" pelas pontas redondas */
}

/* Estilos Desktop (Media Query) */
@media (min-width: 768px) {

  .meu-container {
    max-width: 600px;
    margin: 0 auto;
  }
}

/* Ajuste de Modais para o topo no Mobile */
@media (max-width: 767px) {
  dialog.modal-top {
    align-items: flex-start !important;
    padding-top: 1rem !important;
  }
}

/* Esconder elementos condicionalmente */
.hidden {
  display: none !important;
}

.theme-options {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.theme-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-option {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 0.5rem;
  cursor: pointer;
  color: var(--pico-muted-color);
  background: var(--pico-background-color);
  transition: all 0.2s ease;
}


.theme-option.active {
  border-color: var(--pico-primary);
  color: var(--pico-muted-color);

  background: color-mix(in srgb, var(--pico-primary) 10%, transparent);
}

.theme-inline {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.context-option {
  margin-bottom: 0.2rem;
  width: 100%;
  text-align: left;
  padding: 0.2rem;
  background: var(--pico-primary);
}

.context-option.active {
  border-color: var(--pico-primary);
  color: var(--pico-primary);
  background: color-mix(in srgb, var(--pico-primary) 10%, transparent);
}

.context-current-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.08rem 0.35rem;
  border-radius: 0.35rem;
  font-size: 0.72rem;
  line-height: 1.1;
  color: var(--pico-primary);
  border: 1px solid color-mix(in srgb, var(--pico-primary) 55%, transparent);
  background: color-mix(in srgb, var(--pico-primary) 13%, transparent);
  vertical-align: middle;
}

.perfil-account-body {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.perfil-error {
  color: #d32f2f;
  margin: 0.4rem 0 0 0;
}

@media (min-width: 768px) {
  .perfil-page {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .perfil-card-account {
    grid-column: 1 / -1;
  }
}

.pesquisa {
  background: color-mix(in srgb, var(--pico-primary) 10%, transparent);
  margin: 0rem;
  width: 100%;
  margin-bottom: 1.5rem;
  overflow: hidden;
  padding: 0.4rem;
  border-radius: 0.75rem;
  overflow: hidden;
}


/* Estilos para Agrupamentos (Fieldset) */
.fieldset-group {
  border: 1px solid var(--pico-muted-border-color);
  padding: 0.5rem;
  border-radius: var(--pico-border-radius);
  margin-bottom: 1.0rem;
}

.fieldset-group legend {
  padding: 0 0.5rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--pico-primary);
  width: auto;
  margin-bottom: 0;
}

/* --- OVERVIEW PANEL STYLES (Migrados do home.js) --- */
.overview-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.overview-top-row {
  display: flex;
  gap: 0.5rem;
}

.overview-top-row>.overview-card {
  flex: 1;
  padding: 0.5rem;
  justify-content: center;
}

.overview-card {
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  padding: 0.3rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
}

.overview-card-header {
  font-size: 1.0rem;
  font-weight: 700;
  color: var(--pico-muted-color);
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.overview-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--pico-h2-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.overview-card-footer {
  font-size: 0.95rem;
  color: var(--pico-muted-color);
}

.overview-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.2rem;
  margin-top: 0.5rem;
}

.overview-list li {
  font-size: 0.85rem;
  padding: 0.1rem 0.2rem;
  margin: 0.1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  background: rgba(59, 130, 246, 0.05);
  border-radius: var(--pico-border-radius);
  border: 1px solid rgba(59, 130, 246, 0.1);
}

.overview-list li strong {
  color: var(--pico-h2-color);
  font-weight: 600;
  min-width: 90px;
}

.overview-list li span {
  color: var(--pico-muted-color);
  font-size: 1rem;
  display: flex;
  font-weight: bold;
  align-items: center;
  gap: 0.2rem;
  white-space: nowrap;
}

.overview-list li span.overview-badge {
  margin-left: auto;
  font-size: 0.9rem;
  font-weight: 700;
  background: #e0f2fe;
  color: #0284c7;
  padding: 0 0.2rem;
  border-radius: 1rem;
}

.overview-list li span.overview-badge-unidade {
  background: color-mix(in srgb, currentColor, transparent 93%);
  border: 1px solid var(--pico-muted-border-color);
  color: var(--pico-muted-color);
  border-radius: 1rem;
  font-size: 1rem;
  font-weight: 700;
  padding: 0 0.2rem;
  min-width: 40px;
}

.badge-item {
  margin-left: auto;
  background: color-mix(in srgb, currentColor, transparent 93%);
  color: gray;
  padding: 0.1rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.8rem;
}

.pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: #10b981;
  border-radius: 50%;
  margin-right: 2px;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }

  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }

  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.pulse-dot-not {
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: var(--pico-del-color);
  border-radius: 50%;
  margin-right: 2px;
}

/* ==================== */
/* INI | SEÇÃO DE AJUDA */
/* ==================== */
.page-help {
  margin-bottom: 1.5rem;
  border: 1px solid var(--pico-form-element-border-color);
  border-radius: var(--pico-border-radius);
  background: color-mix(in srgb, var(--pico-primary) 5%, transparent);
  overflow: hidden;
  /* Evita que o fundo do summary vaze as bordas do radius */
}

.page-help summary {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--pico-color);
  margin-bottom: 0;
  padding: 0.2rem 0.5rem;
  border-bottom: none;
  transition: background 0.2s ease;
}

.page-help summary i {
  width: 16px;
  height: 16px;
  margin-right: 4px;
  vertical-align: text-bottom;
}

.page-help strong {
  color: var(--pico-del-color);
}

.page-help-content {
  font-size: 0.85rem;
  color: var(--pico-h2-color);
  padding: 0.85rem 1rem;
  border-top: 1px dashed var(--pico-form-element-border-color);
}

.page-help-content p {
  margin-bottom: 0.5rem;
}

.page-help-content p:last-child {
  margin-bottom: 0;
}

/* ==================== */
/* FIM | SEÇÃO DE AJUDA */
/* ==================== */

/* ========================================================= */
/* INI | PADRÃO OVERLAY / BOTTOM SHEET (Modais Mobile-First) */
/* ========================================================= */
.bottom-sheet-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000 !important;
  display: none;
  /* Controlado via JS com display: flex */
  align-items: flex-end;
  justify-content: center;
}

.bottom-sheet-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.50);
  animation: fadeIn 0.3s ease;
}

.bottom-sheet {
  position: relative;
  width: 100%;
  max-width: 550px;
  background: var(--pico-background-color);
  border-top-left-radius: 1.5rem;
  border-top-right-radius: 1.5rem;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  max-height: 85vh;
  overflow: hidden;
  animation: slideUpBottom 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 768px) {
  .bottom-sheet {
    margin: 0 1.5rem 1.5rem 1.5rem;
    border-radius: 1.0rem;
    max-height: 80vh;
    max-width: 660px;
    /* Aumentado em 20% (era 550px) */
  }

  .bottom-sheet-container {
    align-items: center;
  }
}

.bottom-sheet-handle {
  width: 40px;
  height: 5px;
  background: var(--pico-muted-border-color);
  border-radius: 5px;
  margin: 12px auto 8px;
  flex-shrink: 0;
  opacity: 0.5;
}

.bottom-sheet .overlay-main-content {
  padding-left: 1.0rem !important;
  padding-right: 1.0rem !important;
  padding-bottom: 2.0rem !important;
  padding-top: 1.0rem !important;
  overflow-y: auto;
  /* Apenas o conteúdo rola */
  -webkit-overflow-scrolling: touch;
  /* Scroll suave no iOS */
}

.overlay-header-compact {
  flex-shrink: 0;
  z-index: 10001 !important;
}

.container-header-overlay {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-left: 1.0rem !important;
  padding-right: 1.0rem !important;
  padding-top: 0.5rem !important;
  max-width: 100% !important;
}

.overlay-title-compact {
  font-size: 1.1rem !important;
  font-weight: 600 !important;
  margin: 0 !important;
  color: var(--pico-ins-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Botões de Ação no Header do Overlay */
.btn-header-action {
  width: 42px !important;
  height: 42px !important;
  padding: 0 !important;
  display: flex;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 8px !important;
  /* Retangular com cantos suaves */
  margin: 0 !important;
  transition: transform 0.2s, background 0.2s;
}

.btn-header-action:active {
  transform: scale(0.92);
}

.btn-header-action i {
  width: 20px;
  height: 20px;
}

.btn-header-save {
  background: var(--pico-primary) !important;
  color: white !important;
  border: none !important;
}

.btn-header-delete {
  background: transparent !important;
  color: var(--pico-del-color) !important;
  border: 1px solid var(--pico-del-color) !important;
}

.btn-header-delete:hover {
  background: color-mix(in srgb, var(--pico-del-color) 10%, transparent) !important;
}

@keyframes slideUpBottom {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Garante que as notificações do Notyf fiquem acima de qualquer Bottom-Sheet ou Overlay */
.notyf {
  z-index: 20000 !important;
}

/* ========================================================= */
/* FIM | PADRÃO OVERLAY / BOTTOM SHEET (Modais Mobile-First) */
/* ========================================================= */


/* ========================================================= */
/* INI | PADRÃO SUMMARY ACCORDION (Dashboard Colapsável)   */
/* ========================================================= */
.summary-accordion {
  margin-bottom: 1rem;
  border: 1px solid var(--pico-form-element-border-color);
  border-radius: var(--pico-border-radius);
  background: color-mix(in srgb, var(--pico-primary) 5%, transparent);
  overflow: hidden;
}

.summary-accordion summary {
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  background: transparent;
  transition: background 0.2s ease;
}

.summary-accordion-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--pico-color);
}

.summary-accordion-metric {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--pico-color);
  white-space: nowrap;
}

.summary-accordion-status {
  display: flex;
  align-items: center;
  color: var(--pico-color);
}

.summary-accordion small {
  color: inherit;
}

.summary-accordion-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.75rem;
  margin-top: 0.75rem;
  border-top: 1px dashed var(--pico-muted-border-color);
  flex-wrap: nowrap;
  gap: 0.5rem;
}

/* Utilitários para o seletor de tipo dentro do accordion */
.tipo-selector-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.tipo-selector-group button {
  padding: 2px 10px;
  font-size: 0.85rem;
  margin-bottom: 0;
}

.tipo-selector-group button.active {
  background: var(--pico-primary);
  color: var(--pico-primary-inverse);
}

/* Status Badge Genérico */
#cfg-status-badge {
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--pico-secondary-background);
  color: var(--pico-secondary-inverse);
  text-transform: uppercase;
}

/* ========================================================= */
/* FIM | PADRÃO SUMMARY ACCORDION (Dashboard Colapsável)   */
/* ========================================================= */