.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-height-lg);
  width: 100%;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 800;
  gap: var(--space-2);
  padding: 0 10px;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
  white-space: nowrap;
}

@media (min-width: 769px) {
  .button {
    min-height: var(--control-height-md);
    width: auto;
    padding: 0 12px;
    font-size: var(--font-md);
  }
}

.button-primary {
  background: var(--theme-button, var(--brand-primary));
  color: #ffffff;
}

.button-primary:hover {
  background: color-mix(in srgb, var(--theme-button, var(--brand-primary)) 88%, #000000);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-secondary) 22%, transparent);
}

.button-secondary {
  background: var(--brand-surface);
  border-color: var(--brand-border);
  color: var(--brand-text);
}

.button-secondary:hover {
  border-color: color-mix(in srgb, var(--brand-secondary) 62%, var(--brand-border));
  background: color-mix(in srgb, var(--brand-secondary) 10%, var(--brand-surface));
}

.button-danger {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
}

.button-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18);
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled,
.button.is-loading {
  cursor: not-allowed;
  opacity: 0.68;
  transform: none;
}

.card {
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  box-shadow: var(--brand-shadow);
}

@media (min-width: 769px) {
  .card {
    border-radius: var(--brand-radius);
  }
}

.card-header {
  display: grid;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-5);
  border-bottom: 1px solid var(--brand-border);
  padding: var(--space-6);
}

@media (min-width: 769px) {
  .card-header {
    display: flex;
    padding: var(--space-7);
  }
}

.card-body {
  padding: var(--space-6);
}

@media (min-width: 769px) {
  .card-body {
    padding: var(--space-7);
  }
}

.card h2,
.card h3 {
  margin-bottom: 6px;
}

.stat-card {
  display: grid;
  gap: var(--space-3);
  min-height: 104px;
  padding: var(--space-6);
}

.stat-label {
  color: var(--brand-muted);
  font-size: var(--font-sm);
  font-weight: 700;
}

.stat-value {
  color: var(--brand-text);
  font-size: clamp(1.2rem, 1.65vw, 1.62rem);
  font-weight: 850;
}

.stat-note {
  color: var(--brand-muted);
  font-size: var(--font-sm);
}

.form-group {
  display: grid;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.form-label {
  color: var(--brand-text);
  font-size: var(--font-md);
  font-weight: 800;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--brand-border);
  border-radius: 10px;
  background: #ffffff;
  color: var(--brand-text);
  min-height: var(--control-height-md);
  padding: 8px 10px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--brand-secondary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-secondary) 24%, transparent);
  outline: 0;
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  background: var(--color-neutral-100);
  color: var(--brand-muted);
  cursor: not-allowed;
}

.color-hex-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-hex-picker {
  width: var(--control-height-md);
  height: var(--control-height-md);
  flex: 0 0 var(--control-height-md);
  border: 1px solid var(--brand-border);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  padding: 2px;
}

.service-color-swatch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.service-color-swatch::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 1px solid color-mix(in srgb, var(--service-color, #5EB1BF) 55%, var(--brand-border));
  border-radius: 5px;
  background: var(--service-color, #5EB1BF);
}

.text-uppercase {
  text-transform: uppercase;
}

.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand-secondary) 22%, #ffffff);
  color: var(--brand-primary);
  font-size: var(--font-sm);
  font-weight: 800;
  padding: 3px 8px;
}

.badge-muted {
  background: var(--color-neutral-100);
  color: var(--brand-muted);
}

.empty-state {
  display: grid;
  min-height: 176px;
  place-items: center;
  border: 1px dashed var(--brand-border);
  border-radius: var(--brand-radius);
  background: color-mix(in srgb, var(--brand-surface) 84%, var(--brand-secondary) 16%);
  padding: 22px;
  text-align: center;
}

.empty-state h2,
.empty-state h3 {
  margin-bottom: 6px;
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 80;
  align-items: stretch;
  justify-content: stretch;
  background: rgba(4, 42, 43, 0.42);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 0;
}

@media (min-width: 769px) {
  .modal {
    align-items: center;
    justify-content: center;
    padding: 20px;
  }
}

.modal.is-open {
  display: flex;
}

.modal-content {
  width: 100%;
  max-width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  overflow-y: auto;
  background: var(--brand-surface);
  border-radius: 0;
  box-shadow: var(--brand-shadow);
  padding: var(--space-6);
}

@media (min-width: 769px) {
  .modal-content {
    width: min(100%, 520px);
    height: auto;
    max-height: calc(100dvh - 24px);
    border-radius: var(--brand-radius);
    padding: var(--space-7);
  }
}

.modal-danger {
  border: 1px solid rgba(220, 38, 38, 0.24);
}

.confirm-delete-modal .modal-content {
  width: min(100%, 480px);
}

/* Precisa ficar acima do Modal do Paciente (.patient-modal, z-index: 130 em
   patient-details.css) — a confirmacao de exclusao pode ser aberta de dentro
   dele (ex.: excluir anexo), e o confirm-delete-modal e sempre anexado como
   irmao de <body>, fora da arvore do modal que o disparou. */
.confirm-delete-modal {
  z-index: 140;
}

[data-confirm-delete-message] {
  white-space: pre-line;
}

.confirm-delete-modal.is-warning .modal-danger {
  border-color: rgba(122, 91, 32, 0.24);
}

.confirm-delete-modal.is-warning .danger-icon {
  background: #F4EDE0;
  color: #7A5B20;
}

.confirm-delete-modal.is-warning .danger-text {
  color: #3F4E4F;
}

.confirm-delete-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.danger-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 999px;
  background: #fee2e2;
  color: #b91c1c;
  font-weight: 900;
}

.danger-text {
  color: #7f1d1d;
  margin: 4px 0 0;
}

.modal-content.company-modal,
.modal-content.wide-modal {
  width: min(100%, 720px);
}

/* Minimodal suspenso de clientes, compartilhado por Clientes e Relacionamento. */
.client-recurrence-popover {
  position: fixed;
  z-index: 2100;
  display: grid;
  gap: 12px;
  width: min(380px, calc(100vw - 24px));
  max-height: min(420px, calc(100dvh - 24px));
  overflow: hidden;
  border: 1px solid rgba(4, 42, 43, 0.12);
  border-radius: 18px;
  background: #fcfcfc;
  box-shadow: 0 20px 46px rgba(4, 42, 43, 0.16);
  padding: 14px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.client-recurrence-popover.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.client-recurrence-popover::before {
  position: absolute;
  top: -6px;
  left: 32px;
  width: 12px;
  height: 12px;
  border-left: 1px solid rgba(4, 42, 43, 0.12);
  border-top: 1px solid rgba(4, 42, 43, 0.12);
  background: #fcfcfc;
  content: "";
  transform: rotate(45deg);
}

.client-recurrence-popover-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(4, 42, 43, 0.08);
  padding-bottom: 10px;
}

.client-recurrence-popover-header h2 {
  color: #042a2b;
  font-size: 0.98rem;
  font-weight: 900;
}

.client-recurrence-popover-header p,
.client-recurrence-empty {
  margin-top: 4px;
  color: var(--brand-muted);
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.35;
}

.client-recurrence-close {
  border: 1px solid rgba(4, 42, 43, 0.12);
  border-radius: 999px;
  background: #ffffff;
  color: #042a2b;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 850;
  padding: 6px 10px;
}

.client-recurrence-close:hover,
.client-recurrence-close:focus-visible {
  outline: 0;
  background: rgba(94, 177, 191, 0.12);
}

.client-recurrence-total {
  color: #042a2b;
  font-size: 0.84rem;
  font-weight: 750;
}

.client-recurrence-list {
  display: grid;
  gap: 2px;
  max-height: 292px;
  overflow-y: auto;
  padding-right: 4px;
}

.client-recurrence-item {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 0;
  border-top: 1px solid rgba(4, 42, 43, 0.08);
  background: transparent;
  cursor: pointer;
  padding: 11px 8px;
  text-align: left;
  transition: background 0.16s ease, transform 0.16s ease;
}

.client-recurrence-item:first-child {
  border-top: 0;
}

.client-recurrence-item strong {
  color: #042a2b;
  font-size: 0.9rem;
  font-weight: 900;
}

.client-recurrence-item span {
  color: var(--brand-muted);
  font-size: 0.79rem;
  font-weight: 700;
  line-height: 1.35;
}

.client-recurrence-item:hover,
.client-recurrence-item:focus-visible {
  outline: 0;
  border-radius: 12px;
  background: rgba(94, 177, 191, 0.10);
  transform: translateX(2px);
}

@media (max-width: 560px) {
  .client-recurrence-popover {
    width: calc(100vw - 24px);
    max-width: 420px;
    max-height: 70dvh;
  }

  .client-recurrence-list {
    max-height: calc(70dvh - 128px);
  }
}

/* ==========================================================================
   M3B - Central de Notificacoes (assets/js/notifications-center.js).
   Superficie unica montada no <body>: drawer flutuante a direita no desktop,
   tela cheia de aplicativo ate 860px (navegador e PWA instalada: mesma
   interface). Cobre a bottom nav como as demais telas cheias do app (os
   .modal do mobile ficam em z-index 80; aqui 95). Tokens --nc-* proprios
   (dialogo fora do shell) derivados do tema da empresa.
   ========================================================================== */
.nc-layer {
  --nc-ink: var(--brand-text, #042A2B);
  --nc-muted: var(--brand-muted, rgba(4, 42, 43, 0.62));
  --nc-line: var(--brand-border, rgba(4, 42, 43, 0.12));
  --nc-surface: var(--brand-surface, #FFFFFF);
  --nc-canvas: var(--brand-background, #FCFCFC);
  --nc-primary: var(--brand-primary, #042A2B);
  --nc-secondary: var(--brand-secondary, #5EB1BF);
  --nc-accent: var(--brand-accent, #54F2F2);
  --nc-focus: 0 0 0 3px color-mix(in srgb, var(--nc-secondary) 45%, transparent);
  --nc-gutter: 20px;
  position: fixed;
  inset: 0;
  z-index: 95;
}

.nc-layer[hidden] {
  display: none;
}

.nc-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 42, 43, 0.28);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.nc-surface {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  width: clamp(400px, 32vw, 448px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--nc-line);
  border-radius: 20px;
  background: var(--nc-canvas);
  box-shadow: 0 24px 64px rgba(4, 42, 43, 0.22), 0 2px 8px rgba(4, 42, 43, 0.06);
  color: var(--nc-ink);
  outline: none;
  opacity: 0;
  transform: translateX(24px);
  transition: opacity 0.2s ease, transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.nc-layer.is-open .nc-backdrop {
  opacity: 1;
}

.nc-layer.is-open .nc-surface {
  opacity: 1;
  transform: none;
}

.nc-view {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
}

.nc-view[hidden] {
  display: none;
}

/* ---- Cabecalho --------------------------------------------------------- */
.nc-header {
  flex: 0 0 auto;
  border-bottom: 1px solid var(--nc-line);
  background: var(--nc-canvas);
  padding: 14px var(--nc-gutter) 12px;
}

.nc-header-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 4px;
}

.nc-header-bar .nc-heading {
  grid-column: 1;
  grid-row: 1;
}

.nc-header-bar [data-notification-open-settings] {
  grid-column: 2;
  grid-row: 1;
}

.nc-header-bar .nc-close {
  grid-column: 3;
  grid-row: 1;
  margin-right: -8px;
}

.nc-header-bar-settings {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.nc-header-bar-settings .nc-back {
  grid-column: 1;
  grid-row: 1;
  margin-left: -10px;
}

.nc-header-bar-settings .nc-heading {
  grid-column: 2;
}

.nc-header-bar-settings .nc-close {
  grid-column: 3;
}

.nc-heading {
  min-width: 0;
}

.nc-heading h2 {
  margin: 0;
  color: var(--nc-ink);
  font-size: 1.22rem;
  font-weight: 850;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.nc-summary {
  min-height: 1.2em;
  margin: 2px 0 0;
  color: var(--nc-muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.nc-icon-button {
  display: inline-flex;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--nc-ink);
  cursor: pointer;
  padding: 0;
  transition: background 0.16s ease;
}

.nc-icon-button:hover {
  background: color-mix(in srgb, var(--nc-secondary) 14%, transparent);
}

.nc-icon-button:focus-visible,
.nc-tab:focus-visible,
.nc-text-button:focus-visible,
.nc-soft-button:focus-visible,
.nc-item-cta:focus-visible,
.nc-item-read:focus-visible,
.nc-switch:focus-visible,
.nc-item:focus-visible,
.nc-surface:focus-visible {
  box-shadow: var(--nc-focus);
  outline: none;
}

.nc-icon-button svg,
.nc-text-button svg,
.nc-item-cta svg,
.nc-item-read svg,
.nc-empty-icon svg,
.nc-item-icon svg,
.nc-device-icon svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nc-icon-button svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.nc-close-x,
.nc-close-back {
  display: inline-flex;
}

.nc-close .nc-close-back {
  display: none;
}

/* ---- Filtros (tabs) + marcar todas ------------------------------------- */
.nc-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.nc-tabs {
  display: inline-flex;
  gap: 2px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--nc-primary) 6%, var(--nc-surface));
  padding: 3px;
}

/* 38px visuais + 3px de trilho em cima/embaixo = alvo de 44px. */
.nc-tab {
  position: relative;
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 7px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--nc-muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 750;
  padding: 0 14px;
  transition: background 0.16s ease, color 0.16s ease;
}

.nc-tab::before {
  position: absolute;
  inset: -3px 0;
  content: "";
}

.nc-tab[aria-selected="true"] {
  background: var(--nc-surface);
  box-shadow: 0 1px 3px rgba(4, 42, 43, 0.12);
  color: var(--nc-ink);
}

.nc-tab-count {
  display: inline-flex;
  min-width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--nc-primary);
  color: var(--nc-surface);
  font-size: 0.7rem;
  font-weight: 850;
  padding: 0 6px;
}

.nc-tab-count[hidden] {
  display: none;
}

.nc-text-button {
  display: inline-flex;
  min-height: 44px;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  margin-right: -8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: color-mix(in srgb, var(--nc-primary) 78%, var(--nc-secondary));
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 750;
  padding: 0 10px;
  white-space: nowrap;
}

.nc-text-button[hidden] {
  display: none;
}

.nc-text-button:hover {
  background: color-mix(in srgb, var(--nc-secondary) 12%, transparent);
}

.nc-text-button:disabled {
  cursor: progress;
  opacity: 0.65;
}

.nc-text-button svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

/* ---- Aviso discreto (erro ao marcar etc.) ------------------------------ */
.nc-status {
  display: none;
  margin: 10px var(--nc-gutter) 0;
  border-radius: 12px;
  background: color-mix(in srgb, #b42318 9%, var(--nc-surface));
  color: #8f1d14;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 9px 12px;
}

.nc-status.is-visible {
  display: block;
}

.nc-status[data-tone="success"] {
  background: color-mix(in srgb, #15803d 10%, var(--nc-surface));
  color: #14532d;
}

/* ---- Lista ------------------------------------------------------------- */
.nc-scroll {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px var(--nc-gutter) 20px;
}

.nc-group {
  padding-top: 14px;
}

.nc-group-title {
  margin: 0 0 8px 2px;
  color: var(--nc-muted);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nc-group-items {
  display: grid;
  gap: 8px;
}

.nc-item {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  border: 1px solid color-mix(in srgb, var(--nc-line) 80%, transparent);
  border-radius: 16px;
  background: var(--nc-surface);
  padding: 14px 6px 14px 14px;
  outline: none;
}

.nc-item:not(.is-unread) {
  padding-right: 14px;
}

.nc-item.is-unread {
  border-color: color-mix(in srgb, var(--nc-secondary) 34%, var(--nc-line));
  background: color-mix(in srgb, var(--nc-secondary) 7%, var(--nc-surface));
}

.nc-item-icon {
  display: inline-flex;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: color-mix(in srgb, var(--nc-primary) 7%, var(--nc-surface));
  color: var(--nc-primary);
}

.nc-item-icon.is-return {
  background: color-mix(in srgb, var(--nc-accent) 26%, var(--nc-surface));
}

.nc-item-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.9;
}

.nc-item-main {
  display: grid;
  min-width: 0;
  gap: 4px;
  padding-top: 1px;
}

.nc-item-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--nc-ink);
  font-size: 0.93rem;
  font-weight: 750;
  line-height: 1.3;
}

.nc-item.is-unread .nc-item-title {
  font-weight: 850;
}

.nc-unread-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--nc-secondary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--nc-secondary) 22%, transparent);
}

.nc-item-text {
  margin: 0;
  color: color-mix(in srgb, var(--nc-ink) 80%, transparent);
  font-size: 0.86rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.nc-item-time {
  color: var(--nc-muted);
  font-size: 0.76rem;
  font-weight: 600;
}

/* 36px visuais + 4px de margem invisivel em volta = alvo de 44px. */
.nc-item-cta {
  position: relative;
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-self: start;
  gap: 6px;
  margin-top: 6px;
  border: 1px solid color-mix(in srgb, var(--nc-primary) 22%, var(--nc-line));
  border-radius: 999px;
  background: var(--nc-surface);
  color: var(--nc-primary);
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0 12px 0 14px;
  text-decoration: none;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.nc-item-cta::before {
  position: absolute;
  inset: -5px;
  content: "";
}

.nc-item-cta.is-primary {
  border-color: var(--nc-primary);
  background: var(--nc-primary);
  color: var(--nc-surface);
}

.nc-item-cta:hover {
  border-color: var(--nc-primary);
  background: color-mix(in srgb, var(--nc-secondary) 14%, var(--nc-surface));
}

.nc-item-cta.is-primary:hover {
  background: color-mix(in srgb, var(--nc-primary) 86%, #000000);
}

.nc-item-cta.is-busy {
  cursor: progress;
  opacity: 0.75;
}

.nc-item-cta svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
  transition: transform 0.16s ease;
}

.nc-item-cta:hover svg {
  transform: translateX(2px);
}

/* "Marcar como lida": alvo de 44px, visual de um anel discreto com check. */
.nc-item-read {
  display: inline-flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  margin: -8px 0 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--nc-muted);
  cursor: pointer;
  padding: 0;
}

.nc-item-read-ring {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border: 1.5px solid color-mix(in srgb, var(--nc-primary) 24%, transparent);
  border-radius: 50%;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.nc-item-read svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.4;
}

.nc-item-read:hover .nc-item-read-ring,
.nc-item-read:focus-visible .nc-item-read-ring {
  border-color: var(--nc-primary);
  background: var(--nc-primary);
  color: var(--nc-surface);
}

.nc-item-read:disabled {
  cursor: progress;
  opacity: 0.5;
}

/* ---- Estados ----------------------------------------------------------- */
.nc-empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  margin: 0 auto;
  max-width: 300px;
  padding: 56px 8px 32px;
  text-align: center;
}

.nc-empty-icon {
  display: inline-flex;
  width: 52px;
  height: 52px;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--nc-accent) 24%, var(--nc-surface));
  color: var(--nc-primary);
}

.nc-empty.is-error .nc-empty-icon {
  background: color-mix(in srgb, #b42318 10%, var(--nc-surface));
  color: #8f1d14;
}

.nc-empty.is-neutral .nc-empty-icon {
  background: color-mix(in srgb, var(--nc-primary) 7%, var(--nc-surface));
}

.nc-empty-icon svg {
  width: 24px;
  height: 24px;
  stroke-width: 2.2;
}

.nc-empty-title {
  margin: 0;
  color: var(--nc-ink);
  font-size: 1rem;
  font-weight: 800;
}

.nc-empty-text {
  margin: 0;
  color: var(--nc-muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.nc-empty .nc-soft-button {
  margin-top: 10px;
}

.nc-soft-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--nc-primary) 18%, var(--nc-line));
  border-radius: 12px;
  background: var(--nc-surface);
  color: var(--nc-primary);
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  padding: 0 16px;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.nc-soft-button:hover {
  border-color: var(--nc-primary);
  background: color-mix(in srgb, var(--nc-secondary) 12%, var(--nc-surface));
}

.nc-soft-button[aria-disabled="true"] {
  cursor: progress;
  opacity: 0.7;
}

.nc-soft-button.is-compact {
  min-height: 44px;
  padding: 0 14px;
}

.nc-soft-button.is-quiet {
  border-color: color-mix(in srgb, var(--nc-line) 90%, transparent);
  color: var(--nc-muted);
}

.nc-footer {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 16px 0 4px;
}

.nc-footer[hidden] {
  display: none;
}

.nc-footer .nc-soft-button {
  width: 100%;
}

.nc-footer-error {
  margin: 0;
  color: #8f1d14;
  font-size: 0.82rem;
  font-weight: 700;
}

.nc-skeleton-list {
  display: grid;
  gap: 8px;
  padding-top: 18px;
}

.nc-skeleton-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid color-mix(in srgb, var(--nc-line) 70%, transparent);
  border-radius: 16px;
  background: var(--nc-surface);
  padding: 14px;
}

.nc-skeleton-lines {
  display: grid;
  gap: 8px;
  padding-top: 2px;
}

.nc-skeleton {
  display: block;
  border-radius: 8px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--nc-primary) 6%, transparent) 25%, color-mix(in srgb, var(--nc-primary) 11%, transparent) 50%, color-mix(in srgb, var(--nc-primary) 6%, transparent) 75%);
  background-size: 200% 100%;
  animation: nc-shimmer 1.3s ease-in-out infinite;
}

.nc-skeleton-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.nc-skeleton-line {
  height: 10px;
}

.nc-skeleton-line.is-title {
  width: 55%;
  height: 12px;
}

.nc-skeleton-line.is-short {
  width: 30%;
}

.nc-skeleton-card {
  height: 168px;
  border-radius: 16px;
}

@keyframes nc-shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

/* ---- Configuracoes ----------------------------------------------------- */
.nc-settings {
  display: grid;
  gap: 22px;
  padding-top: 14px;
}

.nc-settings-live:empty {
  display: none;
}

.nc-settings-message {
  margin: 0;
  border-radius: 12px;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 10px 12px;
}

.nc-settings-message.is-success {
  background: color-mix(in srgb, #15803d 10%, var(--nc-surface));
  color: #14532d;
}

.nc-settings-message.is-warning {
  background: color-mix(in srgb, #b45309 11%, var(--nc-surface));
  color: #7c2d12;
}

.nc-settings-message.is-error {
  background: color-mix(in srgb, #b42318 9%, var(--nc-surface));
  color: #8f1d14;
}

.nc-settings-section {
  display: grid;
  gap: 8px;
}

.nc-section-title {
  margin: 0 0 0 2px;
  color: var(--nc-ink);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nc-section-hint {
  margin: -4px 0 4px 2px;
  color: var(--nc-muted);
  font-size: 0.82rem;
}

.nc-pref-card,
.nc-device-card {
  border: 1px solid color-mix(in srgb, var(--nc-line) 85%, transparent);
  border-radius: 16px;
  background: var(--nc-surface);
}

.nc-pref-card {
  padding: 14px 10px 6px 14px;
}

.nc-pref-head {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  padding: 0 4px 10px 0;
}

.nc-pref-title {
  margin: 0;
  font-size: 0.93rem;
  font-weight: 850;
}

.nc-pref-description {
  margin: 3px 0 0;
  color: var(--nc-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.nc-pref-rows {
  display: grid;
}

.nc-pref-row {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid color-mix(in srgb, var(--nc-line) 70%, transparent);
}

.nc-pref-row-label {
  color: var(--nc-ink);
  font-size: 0.9rem;
  font-weight: 700;
}

.nc-pref-row.is-disabled .nc-pref-row-label {
  color: var(--nc-muted);
}

/* Popup "Ative suas notificacoes": dialogo central no desktop, folha inferior ate 860px. */
.nc-consent-layer {
  z-index: 96;
}

.nc-consent {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--nc-line);
  border-radius: 20px;
  background: var(--nc-surface);
  box-shadow: 0 24px 64px rgba(4, 42, 43, 0.22), 0 2px 8px rgba(4, 42, 43, 0.06);
  color: var(--nc-ink);
  opacity: 0;
  outline: none;
  transform: translate(-50%, calc(-50% + 12px));
  transition: opacity 0.2s ease, transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.nc-consent-layer.is-open .nc-backdrop {
  opacity: 1;
}

.nc-consent-layer.is-open .nc-consent {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.nc-consent-card {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 24px 22px 20px;
}

.nc-consent-close {
  position: absolute;
  top: 10px;
  right: 10px;
}

.nc-consent-icon {
  display: inline-flex;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: color-mix(in srgb, var(--nc-secondary) 16%, var(--nc-surface));
  color: var(--nc-primary);
}

.nc-consent-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.nc-consent-title {
  margin: 0;
  padding-right: 36px;
  font-size: 1.12rem;
  font-weight: 850;
}

.nc-consent-text {
  margin: 0;
  color: var(--nc-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.nc-consent-actions {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.nc-consent-primary {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  background: var(--theme-button, var(--nc-primary));
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  padding: 0 18px;
}

.nc-consent-primary[aria-disabled="true"] {
  cursor: progress;
  opacity: 0.75;
}

.nc-consent-primary:focus-visible,
.nc-consent-secondary:focus-visible,
.nc-consent-close:focus-visible {
  box-shadow: var(--nc-focus);
  outline: none;
}

.nc-consent-secondary {
  min-height: 48px;
}

.nc-consent-hint {
  margin: 0;
  color: var(--nc-muted);
  font-size: 0.78rem;
  text-align: center;
}

@media (max-width: 860px) {
  .nc-consent {
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    border-radius: 22px 22px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    transform: translateY(24px);
  }

  .nc-consent-layer.is-open .nc-consent {
    transform: none;
  }
}

/* A Central esconde o backdrop em tela cheia ate 860px; o popup e uma folha e precisa dele. */
@media (max-width: 860px) {
  .nc-consent-layer .nc-backdrop {
    display: block;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nc-consent {
    transition: none;
  }
}

.nc-pref-group-title {
  margin: 10px 2px 2px;
  color: var(--nc-muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.nc-pref-select {
  min-height: 40px;
  max-width: 60%;
  border: 1px solid color-mix(in srgb, var(--nc-line) 90%, transparent);
  border-radius: 10px;
  background: var(--nc-surface);
  color: var(--nc-ink);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  padding: 0 10px;
}

.nc-pref-select:disabled {
  color: var(--nc-muted);
  cursor: not-allowed;
}

.nc-pref-hint {
  margin: 0 4px 10px 0;
  color: var(--nc-muted);
  font-size: 0.8rem;
}

/* Switch: alvo de 52x44, trilho 44x26. */
.nc-switch {
  display: inline-flex;
  width: 52px;
  height: 44px;
  flex: 0 0 52px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.nc-switch-track {
  position: relative;
  display: block;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--nc-primary) 22%, var(--nc-surface));
  transition: background 0.18s ease;
}

.nc-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(4, 42, 43, 0.3);
  transition: transform 0.18s ease;
}

.nc-switch[aria-checked="true"] .nc-switch-track {
  background: var(--nc-primary);
}

.nc-switch[aria-checked="true"] .nc-switch-thumb {
  transform: translateX(18px);
}

.nc-switch:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.nc-switch[aria-busy="true"] {
  cursor: progress;
  opacity: 0.7;
}

.nc-device-card {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 14px;
}

.nc-device-card > .nc-soft-button {
  grid-column: 1 / -1;
  justify-self: stretch;
}

.nc-device-icon {
  display: inline-flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: color-mix(in srgb, var(--nc-primary) 7%, var(--nc-surface));
  color: var(--nc-primary);
}

.nc-device-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.9;
}

.nc-device-card.is-success .nc-device-icon {
  background: color-mix(in srgb, #15803d 13%, var(--nc-surface));
  color: #14532d;
}

.nc-device-card.is-warning .nc-device-icon {
  background: color-mix(in srgb, #b45309 13%, var(--nc-surface));
  color: #7c2d12;
}

.nc-device-text strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 800;
}

.nc-device-text p {
  margin: 2px 0 0;
  color: var(--nc-muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

/* Trava a rolagem da pagina por baixo da Central aberta. */
html.notification-scroll-lock,
html.notification-scroll-lock body {
  overflow: hidden;
}

/* ---- Ate 860px: tela cheia de aplicativo (navegador = PWA) -------------- */
@media (max-width: 860px) {
  .nc-layer {
    --nc-gutter: max(16px, env(safe-area-inset-left, 0px));
  }

  .nc-backdrop {
    display: none;
  }

  .nc-surface {
    inset: 0;
    width: auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    transform: translateY(12px);
  }

  .nc-header {
    padding: calc(8px + env(safe-area-inset-top, 0px)) max(var(--nc-gutter), env(safe-area-inset-right, 0px)) 12px var(--nc-gutter);
  }

  /* Voltar a esquerda (padrao das telas do app); X so no desktop. */
  .nc-header-bar {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .nc-header-bar .nc-close {
    grid-column: 1;
    margin: 0 0 0 -10px;
  }

  .nc-header-bar .nc-heading {
    grid-column: 2;
  }

  .nc-header-bar [data-notification-open-settings] {
    grid-column: 3;
    margin-right: -10px;
  }

  .nc-close .nc-close-x {
    display: none;
  }

  .nc-close .nc-close-back {
    display: inline-flex;
  }

  .nc-header-bar-settings {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .nc-header-bar-settings .nc-close-settings {
    display: none;
  }

  .nc-heading h2 {
    font-size: 1.16rem;
  }

  .nc-scroll {
    padding: 4px max(var(--nc-gutter), env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) var(--nc-gutter);
  }

  .nc-status {
    margin-right: max(var(--nc-gutter), env(safe-area-inset-right, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .nc-backdrop,
  .nc-surface,
  .nc-item-cta,
  .nc-item-cta svg,
  .nc-switch-track,
  .nc-switch-thumb {
    transition: none;
  }

  .nc-surface {
    transform: none;
  }

  .nc-skeleton {
    animation: none;
  }
}

.table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  min-width: 760px;
  table-layout: fixed;
}

@media (min-width: 769px) {
  .table {
    min-width: 860px;
  }
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.table th,
.table td {
  border-bottom: 1px solid var(--brand-border);
  overflow: hidden;
  padding: 8px 10px;
  text-align: left;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

@media (min-width: 769px) {
  .table th,
  .table td {
    padding: 9px 10px;
  }
}

.table th:last-child,
.table td:last-child,
.table .actions-column,
.table .table-col-actions {
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  width: var(--table-actions-width);
  min-width: var(--table-actions-min-width);
}

@media (min-width: 769px) {
  .table th:last-child,
  .table td:last-child,
  .table .actions-column,
  .table .table-col-actions {
    width: var(--table-actions-width);
    min-width: var(--table-actions-min-width);
  }
}

.table th {
  color: var(--brand-muted);
  font-size: var(--font-sm);
  text-transform: uppercase;
}

.table-actions {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: var(--space-2);
  white-space: nowrap;
}

.table-actions .button {
  flex: 0 0 auto;
  width: auto;
  min-height: var(--control-height-sm);
  padding-inline: 10px;
}

.crud-toolbar {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: 1fr;
  margin-bottom: var(--space-6);
}

@media (min-width: 769px) {
  .crud-toolbar {
    grid-template-columns: minmax(220px, 1fr) 180px;
  }
}

.crud-content {
  min-height: 180px;
}

.crud-actions {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

@media (min-width: 769px) {
  .crud-actions {
    flex-direction: row;
  }
}

.crud-actions .button {
  width: 100%;
}

@media (min-width: 769px) {
  .crud-actions .button {
    width: auto;
  }
}

.crud-pagination {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: stretch;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-5);
  border-top: 1px solid var(--brand-border);
  padding-top: var(--space-5);
}

@media (min-width: 769px) {
  .crud-pagination {
    grid-template-columns: auto minmax(0, 1fr) auto;
    justify-items: normal;
  }
}

.crud-pagination-size,
.crud-pagination-actions {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

@media (min-width: 769px) {
  .crud-pagination-size,
  .crud-pagination-actions {
    justify-content: flex-start;
  }
}

.crud-pagination-size {
  color: var(--brand-muted);
  font-size: var(--font-sm);
  font-weight: 750;
}

.crud-pagination-size .select {
  width: auto;
  min-width: 86px;
  min-height: var(--control-height-sm);
  padding: 6px 30px 6px 10px;
}

.crud-pagination-summary,
.crud-pagination-actions span {
  color: var(--brand-muted);
  font-size: var(--font-sm);
  font-weight: 750;
  text-align: center;
}

.crud-pagination-actions .button {
  min-height: var(--control-height-sm);
  width: auto;
  padding-inline: 10px;
}

/* ==========================================================================
   Skeleton loading — componente global reutilizavel (todas as telas)
   ========================================================================== */

.skeleton-line,
.skeleton-block,
.skeleton-avatar,
.skeleton-button {
  display: block;
  border-radius: 10px;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--brand-border) 55%, var(--brand-surface)) 25%,
    var(--brand-surface) 50%,
    color-mix(in srgb, var(--brand-border) 55%, var(--brand-surface)) 75%
  );
  background-size: 220% 100%;
  animation: skeleton-shimmer 1.25s ease-in-out infinite;
}

.skeleton-line {
  height: 14px;
  margin: 6px 0;
}

.skeleton-line.is-title {
  height: 22px;
  width: 55%;
  border-radius: 10px;
}

.skeleton-line.is-subtitle {
  height: 14px;
  width: 75%;
}

.skeleton-line.is-badge {
  height: 20px;
  width: 122px;
  border-radius: 999px;
}

.skeleton-line.is-search {
  height: 42px;
  border-radius: 12px;
}

.skeleton-line.is-short {
  width: 42%;
}

.skeleton-line.is-full {
  width: 100%;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 50%;
}

.skeleton-button {
  width: 130px;
  height: 42px;
}

.skeleton-table-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 13px 12px;
  border-bottom: 1px solid var(--brand-border);
}

.skeleton-table-row .skeleton-line {
  flex: 1 1 0;
  margin: 0;
}

.skeleton-card {
  display: grid;
  gap: 10px;
  min-height: 92px;
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  background: var(--brand-surface);
  padding: 16px;
}

.skeleton-card .skeleton-line {
  margin: 0;
}

.skeleton-card-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.skeleton-card-lines {
  display: grid;
  flex: 1 1 auto;
  gap: 6px;
}

.skeleton-stat-card {
  display: grid;
  gap: 10px;
  min-height: 92px;
  padding: 16px;
}

.skeleton-chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 160px;
  padding-top: 10px;
}

.skeleton-chart-bars .skeleton-block {
  flex: 1 1 0;
  min-height: 12%;
  border-radius: 8px 8px 0 0;
}

@keyframes skeleton-shimmer {
  to {
    background-position: -220% 0;
  }
}

.skeleton-fade-out {
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-line,
  .skeleton-block,
  .skeleton-avatar,
  .skeleton-button {
    animation: none;
    background: color-mix(in srgb, var(--brand-border) 55%, var(--brand-surface));
  }

  .skeleton-fade-out {
    transition: none;
  }
}

/* ==========================================================================
   Skeleton de boot — casca de pagina (sidebar + header) usada nos 12 index.html
   ========================================================================== */

.skeleton-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 1fr;
  background: var(--brand-background, #f8faf9);
}

@media (min-width: 769px) {
  .skeleton-shell {
    grid-template-columns: var(--sidebar-width, 260px) minmax(0, 1fr);
  }
}

.skeleton-shell-sidebar {
  display: none;
  align-content: start;
  gap: 14px;
  border-right: 1px solid var(--brand-border, #dce5e3);
  padding: 26px 18px;
}

@media (min-width: 769px) {
  .skeleton-shell-sidebar {
    display: grid;
  }
}

.skeleton-logo {
  width: 170px;
  height: 52px;
  margin-bottom: 24px;
}

.skeleton-nav-item {
  width: 100%;
  height: 42px;
}

.skeleton-nav-item.is-short {
  width: 78%;
}

.skeleton-shell-main {
  position: relative;
  padding: 82px 16px 24px;
}

@media (min-width: 769px) {
  .skeleton-shell-main {
    padding: clamp(38px, 4vw, 64px) var(--page-gutter, clamp(24px, 2vw, 32px));
  }
}

.skeleton-shell-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.skeleton-shell-header > div {
  display: grid;
  gap: 10px;
}

.skeleton-label {
  margin-top: 14px;
  color: var(--brand-muted, #64748b);
  font-size: 0.82rem;
  font-weight: 750;
}
.app-shell-error-main {
  align-items: center;
  display: grid;
  min-height: 100vh;
  padding: 24px;
}

.app-shell-error.empty-state {
  align-items: start;
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius, 12px);
  box-shadow: var(--brand-shadow);
  display: grid;
  gap: 14px;
  grid-template-columns: auto minmax(0, 1fr);
  justify-self: center;
  max-width: 460px;
  min-height: 0;
  padding: 24px;
  text-align: left;
  width: 100%;
}

.app-shell-error h1 {
  color: var(--brand-primary);
  font-size: 1.2rem;
}

.app-shell-error p {
  line-height: 1.5;
  margin-top: 5px;
}

.app-shell-error .button {
  margin-top: 18px;
}

.app-shell-error-icon {
  align-items: center;
  background: color-mix(in srgb, #b45309 12%, var(--brand-surface));
  border-radius: 10px;
  color: #854d0e;
  display: inline-flex;
  height: 40px;
  justify-content: center;
  width: 40px;
}

.app-shell-error-icon svg {
  fill: none;
  height: 21px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 21px;
}

/* Skeleton de boot do shell mobile de app (opt-in por pagina com
   data-skeleton-app-shell, hoje o Dashboard). Ate 860px a casca imita a
   topbar e a bottom nav reais em vez da sidebar desktop; acima disso os
   dois blocos nao existem e o skeleton e o de sempre. */
.skeleton-app-topbar,
.skeleton-app-bottom-nav {
  display: none;
}

@media (max-width: 860px) {
  .skeleton-shell[data-skeleton-app-shell] {
    grid-template-columns: 1fr;
    align-content: start;
    min-height: 100dvh;
  }

  .skeleton-shell[data-skeleton-app-shell] .skeleton-shell-sidebar {
    display: none;
  }

  .skeleton-shell[data-skeleton-app-shell] .skeleton-app-topbar {
    display: flex;
    align-items: center;
    min-height: 60px;
    border-bottom: 1px solid color-mix(in srgb, var(--brand-border) 70%, transparent);
    padding: 8px max(var(--page-gutter, 16px), env(safe-area-inset-right, 0px)) 8px max(var(--page-gutter, 16px), env(safe-area-inset-left, 0px));
  }

  .skeleton-app-topbar .app-logo-full {
    width: auto;
    min-height: 40px;
    gap: 9px;
  }

  .skeleton-app-topbar .app-logo img {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .skeleton-app-topbar .app-logo-wordmark {
    font-size: 1.18rem;
  }

  .skeleton-shell[data-skeleton-app-shell] .skeleton-app-bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    display: block;
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--brand-border);
    background: var(--brand-surface);
  }

  .skeleton-shell[data-skeleton-app-shell] .skeleton-shell-main {
    padding-top: 20px;
    padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  }

  body[data-mobile-app-mode] .skeleton-shell[data-skeleton-app-shell] .skeleton-app-topbar {
    min-height: 0;
    padding-top: calc(6px + env(safe-area-inset-top, 0px));
    padding-bottom: 6px;
  }
}

/* ==========================================================================
   D17 - Experiencia de app no Web Mobile (camada visual do app nativo).
   Tokens espelhados de mobile/src/theme/tokens.ts. So viram aparencia sob
   html[data-app-experience="native"] (assets/js/app-experience.js) ou dentro
   das folhas do app (.app-sheet), que so existem/abrem nesse modo. Desktop
   nao e afetado: propriedades customizadas nao pintam nada sozinhas.
   ========================================================================== */

:root {
  --ah-evergreen: #042A2B;
  --ah-evergreen-soft: #0B3C3D;
  --ah-pacific: #5EB1BF;
  --ah-neon-ice: #54F2F2;
  --ah-canvas: #F4F8F7;
  --ah-surface: #FFFFFF;
  --ah-surface-muted: #F8FAF9;
  --ah-ink: #042A2B;
  --ah-muted: #587071;
  --ah-placeholder: #849797;
  --ah-line: #D9E5E3;
  --ah-line-strong: #BCD0CD;
  --ah-accent-soft: #CCFBFB;
  --ah-selected: #EEF8F6;
  --ah-on-brand-muted: #C7E0DD;
  --ah-overlay: rgba(4, 42, 43, 0.42);
  --ah-danger: #C4514A;
  --ah-danger-ink: #8D312C;
  --ah-danger-bg: #F9E8E6;
  --ah-info-bg: #DFF3F5;
  --ah-info-ink: #266C76;
  --ah-success-bg: #E1F1EB;
  --ah-success-ink: #1D6653;
  --ah-warning-bg: #F4EDE0;
  --ah-warning-ink: #7A5B20;
  /* Texto de destaque (tone "accent" do nativo) com contraste AA no branco. */
  --ah-accent-text: #2B7C88;
  --ah-brand-gradient: linear-gradient(135deg, #042A2B 0%, #0B3C3D 100%);
  --ah-shadow-sm: 0 1px 2px rgba(4, 42, 43, 0.06), 0 4px 12px rgba(4, 42, 43, 0.05);
  --ah-shadow-md: 0 8px 22px rgba(4, 42, 43, 0.08);
  --ah-shadow-nav: 0 -10px 28px rgba(4, 42, 43, 0.07);
  --ah-shadow-sheet: 0 -18px 48px rgba(4, 42, 43, 0.24);
  --ah-radius-control: 14px;
  --ah-radius-card: 20px;
  --ah-radius-header: 24px;
  --ah-gutter: 24px;
}

/* Folha inferior do app (BottomSheet nativo). */
.app-sheet {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.app-sheet[hidden] {
  display: none !important;
}

.app-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: var(--ah-overlay);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.app-sheet.is-open .app-sheet-backdrop {
  opacity: 1;
  transition-duration: 0.22s;
}

.app-sheet-panel {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 16px);
  margin: 0 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 28px 28px 0 0;
  background: var(--ah-surface);
  box-shadow: var(--ah-shadow-sheet);
  color: var(--ah-ink);
  padding: 10px var(--ah-gutter) calc(16px + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%);
  transition: transform 0.15s ease-in;
}

.app-sheet.is-open .app-sheet-panel {
  transform: translateY(0);
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.app-sheet-panel:focus {
  outline: 0;
}

.app-sheet-handle {
  display: block;
  width: 40px;
  height: 4px;
  margin: 0 auto 16px;
  border-radius: 999px;
  background: var(--ah-line-strong);
}

html.app-sheet-scroll-lock,
html.app-sheet-scroll-lock body {
  overflow: hidden;
}

/* Conteudo comum das folhas (conta e opcoes). */
.app-sheet-identity {
  display: flex;
  align-items: center;
  gap: 16px;
}

.app-avatar {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: var(--ah-evergreen);
  color: var(--ah-neon-ice);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.app-avatar.is-soft {
  background: var(--ah-accent-soft);
  color: var(--ah-evergreen);
}

.app-sheet-identity-text {
  display: grid;
  min-width: 0;
}

.app-sheet-name {
  overflow: hidden;
  color: var(--ah-ink);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 22px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-sheet-email,
.app-sheet-caption {
  overflow: hidden;
  color: var(--ah-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-sheet-caption {
  white-space: normal;
}

.app-overline {
  color: var(--ah-muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.14em;
  line-height: 14px;
  text-transform: uppercase;
}

.app-sheet-context {
  display: grid;
  gap: 2px;
  margin-top: 24px;
  border: 1px solid var(--ah-line);
  border-radius: var(--ah-radius-control);
  background: var(--ah-surface-muted);
  padding: 16px;
}

.app-sheet-context-title {
  overflow: hidden;
  color: var(--ah-ink);
  font-size: 15px;
  font-weight: 700;
  line-height: 22px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-sheet-group {
  display: grid;
  gap: 2px;
  margin-top: 16px;
}

.app-sheet-group > .app-overline {
  margin-bottom: 2px;
}

.app-sheet-actions {
  display: grid;
  margin-top: 8px;
}

.app-sheet-row {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 64px;
  border: 0;
  border-radius: var(--ah-radius-control);
  background: transparent;
  color: var(--ah-ink);
  cursor: pointer;
  font: inherit;
  padding: 10px 0;
  text-align: left;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.app-sheet-row:active {
  opacity: 0.76;
}

.app-sheet-row:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--ah-pacific) 70%, transparent);
  outline-offset: 2px;
}

.app-sheet-row-icon {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--ah-accent-soft);
  color: var(--ah-evergreen);
}

.app-sheet-row-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-sheet-row-text {
  display: grid;
  flex: 1;
  gap: 1px;
  min-width: 0;
}

.app-sheet-row-title {
  color: var(--ah-ink);
  font-size: 15px;
  font-weight: 700;
  line-height: 22px;
}

.app-sheet-row-subtitle {
  color: var(--ah-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 17px;
}

.app-sheet-chevron {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--ah-pacific);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-sheet-row.is-danger .app-sheet-row-icon {
  background: var(--ah-danger-bg);
  color: var(--ah-danger-ink);
}

.app-sheet-row.is-danger .app-sheet-row-title {
  color: var(--ah-danger-ink);
}

@media (prefers-reduced-motion: reduce) {
  .app-sheet-backdrop,
  .app-sheet-panel,
  .app-sheet.is-open .app-sheet-panel,
  .app-sheet.is-open .app-sheet-backdrop {
    transition: none;
  }
}

/* ==========================================================================
   D17-B - Primitivos do app nativo para os modulos (Dashboard, Agenda).
   Espelham mobile/src/components/ui (fab, chip, icon-button, button,
   state-view, month-calendar, status-badge). Estes elementos so sao
   renderizados no modo app (html[data-app-experience="native"]); no Desktop
   nao existem no DOM.
   ========================================================================== */

.app-icon-button {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--ah-line);
  border-radius: 999px;
  background: var(--ah-surface);
  color: var(--ah-evergreen);
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.app-icon-button.is-ghost {
  border-color: transparent;
  background: transparent;
}

.app-icon-button.is-tonal,
.app-icon-button[aria-pressed="true"] {
  border-color: var(--ah-accent-soft);
  background: var(--ah-accent-soft);
}

.app-icon-button svg,
.app-chip svg,
.app-button svg,
.app-fab svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-icon-button:active,
.app-chip:active,
.app-button:active {
  opacity: 0.76;
  transform: scale(0.97);
}

.app-icon-button:focus-visible,
.app-chip:focus-visible,
.app-button:focus-visible,
.app-fab:focus-visible {
  outline: 2px solid var(--ah-pacific);
  outline-offset: 2px;
}

.app-chip {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  border: 1px solid var(--ah-line-strong);
  border-radius: 999px;
  background: var(--ah-surface);
  color: var(--ah-evergreen-soft);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 18px;
  padding: 0 16px;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.app-chip svg {
  width: 16px;
  height: 16px;
}

.app-chip.is-selected {
  border-color: var(--ah-evergreen);
  background: var(--ah-evergreen);
  color: #FFFFFF;
}

.app-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: var(--ah-radius-control);
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  line-height: 20px;
  padding: 0 20px;
  -webkit-tap-highlight-color: transparent;
}

.app-button svg {
  width: 20px;
  height: 20px;
}

.app-button.is-primary {
  background: var(--ah-evergreen);
  color: #FFFFFF;
}

.app-button.is-secondary {
  border-color: var(--ah-line-strong);
  background: var(--ah-surface);
  color: var(--ah-evergreen);
}

.app-button.is-ghost {
  background: transparent;
  color: var(--ah-evergreen);
}

/* Acao principal flutuante (Fab do app): canto inferior direito, acima da
   barra inferior e respeitando a area segura lateral. */
.app-fab {
  position: fixed;
  right: calc(var(--ah-gutter) + env(safe-area-inset-right, 0px));
  bottom: calc(var(--mobile-app-bottom-nav-height, var(--mobile-bottom-nav-offset, 64px)) + 24px);
  z-index: 40;
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 999px;
  background: var(--ah-evergreen);
  box-shadow: 0 12px 32px rgba(4, 42, 43, 0.18);
  color: var(--ah-neon-ice);
  cursor: pointer;
  padding: 0;
  animation: app-fab-enter 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  -webkit-tap-highlight-color: transparent;
}

.app-fab svg {
  width: 24px;
  height: 24px;
  stroke-width: 2.4;
}

.app-fab:active {
  opacity: 0.76;
  transform: scale(0.98);
}

@keyframes app-fab-enter {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

/* Estados de carregamento / vazio / erro (StateView do app). */
.app-state {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 0;
  padding: 48px 32px;
  text-align: center;
}

.app-state-spinner {
  width: 36px;
  height: 36px;
  border: 3.5px solid var(--ah-evergreen-tint, #C7E0DD);
  border-top-color: var(--ah-evergreen);
  border-radius: 999px;
  animation: app-state-spin 0.8s linear infinite;
}

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

.app-state-mark {
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: var(--ah-accent-soft);
  color: var(--ah-evergreen);
}

.app-state-mark.is-danger {
  background: var(--ah-danger-bg);
  color: var(--ah-danger-ink);
}

.app-state-mark svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-state-title {
  margin-top: 16px;
  color: var(--ah-ink);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 26px;
}

.app-state-message {
  max-width: 320px;
  margin: 8px 0 0;
  color: var(--ah-muted);
  font-size: 15px;
  line-height: 22px;
}

.app-state .app-button {
  margin-top: 24px;
}

/* Calendario mensal em folha (MonthCalendar do app). Serve os dias gerados
   pelo Dashboard (.dashboard-calendar-*) e pela Agenda (.calendar-date-*). */
.app-month-calendar {
  display: grid;
  gap: 4px;
}

.app-month-calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.app-month-calendar-title {
  color: var(--ah-ink);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
  line-height: 22px;
}

.app-month-calendar .dashboard-calendar-weekdays,
.app-month-calendar .app-month-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.app-month-calendar .dashboard-calendar-weekdays span,
.app-month-calendar .app-month-weekdays span {
  color: var(--ah-muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 15px;
  padding: 4px 0;
  text-align: center;
}

.app-month-calendar .dashboard-calendar-grid,
.app-month-calendar .app-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.app-month-calendar .dashboard-calendar-day,
.app-month-calendar .calendar-date-day {
  display: grid;
  place-items: center;
  width: 100%;
  max-height: 48px;
  aspect-ratio: 1;
  border: 1.5px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ah-ink);
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.app-month-calendar .dashboard-calendar-day.is-muted,
.app-month-calendar .calendar-date-day.is-muted {
  color: var(--ah-placeholder);
  font-weight: 500;
}

.app-month-calendar .dashboard-calendar-day.is-today,
.app-month-calendar .calendar-date-day.is-today {
  border-color: var(--ah-pacific);
  color: var(--ah-pacific);
}

.app-month-calendar .dashboard-calendar-day.is-selected,
.app-month-calendar .calendar-date-day.is-selected {
  border-color: var(--ah-evergreen);
  background: var(--ah-evergreen);
  color: #FFFFFF;
}

.app-month-calendar .dashboard-calendar-day:active,
.app-month-calendar .calendar-date-day:active {
  opacity: 0.76;
}

.app-month-calendar .dashboard-calendar-day:focus-visible,
.app-month-calendar .calendar-date-day:focus-visible {
  outline: 2px solid var(--ah-pacific);
  outline-offset: 1px;
}

.app-sheet-wide-button {
  width: 100%;
  margin-top: 16px;
}

/* Cabecalho de folha com titulo (ProfessionalFilterSheet etc.). */
.app-sheet-title {
  margin: 0;
  color: var(--ah-ink);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 26px;
}

.app-sheet-subtitle {
  margin: 2px 0 0;
  color: var(--ah-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 17px;
}

/* Selo de status (StatusBadge + theme/status.ts do app). */
.app-status-badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  border-radius: 999px;
  background: #E8F0EF;
  color: var(--ah-evergreen-soft);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2px;
  line-height: 14px;
  padding: 5px 10px;
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .app-fab,
  .app-state-spinner {
    animation: none;
  }

  .app-icon-button:active,
  .app-chip:active,
  .app-button:active {
    transform: none;
  }
}
