:root {
  color-scheme: light;
  --page: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #f1f0ec;
  --text-primary: #14151a;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid: #e5e4dd;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.09);

  /* Marca Moveis Candido */
  --brand-navy: #2c3481;
  --brand-navy-ink: #2c3481;
  --brand-navy-tint: #e8e9f4;
  --brand-yellow: #f5e319;
  --brand-yellow-ink: #7a6c00;
  --brand-yellow-tint: #fdf9d2;

  --seq-250: #8890c9;
  --seq-350: #5b64ac;
  --seq-450: #2c3481;
  --seq-550: #1f2560;

  /* Menu lateral */
  --sidebar-bg: #232a68;
  --sidebar-bg-2: #2c3481;
  --sidebar-text: #c7cae8;
  --sidebar-text-active: #ffffff;

  --status-good: #0ca30c;
  --status-good-tint: #e6f6e6;
  --status-serious: #ec835a;
  --status-serious-tint: #fdece4;
  --status-critical: #d03b3b;
  --success-text: #006300;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--page);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ------------------------------------------------------------------ */
/* Estrutura geral: menu lateral + area de conteudo                    */
/* ------------------------------------------------------------------ */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  position: relative;
  width: 232px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 12px 0;
  transition: width 0.15s ease;
}
.sidebar.collapsed { width: 68px; }

.sidebar-toggle-btn {
  position: absolute;
  top: 10px;
  right: 8px;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--sidebar-text);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.sidebar-toggle-btn:hover { background: rgba(255, 255, 255, 0.18); color: #fff; }
.sidebar.collapsed .sidebar-toggle-btn { right: 50%; transform: translateX(50%); top: 8px; }

.sidebar .brand {
  padding: 2px 18px 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  text-align: center;
}
.sidebar .brand-logo {
  display: block;
  max-width: 100%;
  height: auto;
  width: 168px;
  margin: 0 auto;
}
.sidebar .brand .sub {
  display: block;
  font-size: 10.5px;
  color: var(--sidebar-text);
  opacity: 0.75;
  margin-top: 6px;
}
.sidebar.collapsed .brand { padding: 8px 6px 10px; }
.sidebar.collapsed .brand-logo { display: none; }
.sidebar.collapsed .brand .sub { display: none; }

.nav-group { padding: 0 10px; margin-bottom: 4px; }
.sidebar.collapsed .nav-group { padding: 0 6px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--sidebar-text);
  cursor: pointer;
  margin-bottom: 2px;
}
.nav-item .ico { width: 16px; text-align: center; flex-shrink: 0; font-size: 14px; }
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-item.active-group { background: rgba(255, 255, 255, 0.08); color: #fff; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px 0; gap: 0; }
.sidebar.collapsed .nav-sub { display: none; }
.sidebar.collapsed .em-breve-badge { display: none; }
.sidebar.collapsed .nav-item .ico { width: auto; font-size: 16px; }

/* Setinha pra recolher/mostrar o submenu (independente da navegacao - clicar
   no nome do menu navega, clicar na setinha so abre/fecha as opcoes) */
.nav-chevron {
  margin-left: auto;
  flex-shrink: 0;
  background: none;
  border: none;
  color: inherit;
  font-size: 9px;
  padding: 5px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease;
}
.nav-chevron:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.nav-item.submenu-collapsed .nav-chevron { transform: rotate(-90deg); }
.nav-sub[hidden] { display: none; }
.sidebar.collapsed .nav-chevron { display: none; }

.nav-sub { padding-left: 8px; margin: 2px 0 8px; }
.nav-sub-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px 7px 30px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--sidebar-text);
  cursor: pointer;
  margin-bottom: 1px;
  border-left: 2px solid transparent;
}
.nav-sub-item:hover { color: #fff; }
.nav-sub-item.active {
  background: rgba(245, 227, 25, 0.14);
  color: #fff;
  border-left: 2px solid var(--brand-yellow);
}

.nav-item.disabled { color: rgba(199, 202, 232, 0.42); cursor: default; }
.nav-item.disabled:hover { background: none; color: rgba(199, 202, 232, 0.42); }
.em-breve-badge {
  margin-left: auto;
  font-size: 9px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.55);
  padding: 2px 6px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.novo-badge {
  margin-left: 6px;
  font-size: 9px;
  font-weight: 700;
  background: var(--brand-yellow);
  color: #1a1a1a;
  padding: 2px 6px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.nav-divider { height: 1px; background: rgba(255, 255, 255, 0.1); margin: 10px 18px; }

.sidebar-footer { margin-top: auto; padding: 10px 18px 0; border-top: 1px solid rgba(255, 255, 255, 0.12); }
.sidebar-footer .user { font-size: 12px; font-weight: 700; color: #fff; margin-bottom: 6px; min-height: 15px; }
.sidebar-footer .sair { font-size: 11.5px; color: var(--sidebar-text); cursor: pointer; display: flex; align-items: center; gap: 7px; }
.sidebar-footer .sair .ico { font-size: 13px; }
.sidebar-footer .sair:hover { color: #fff; }
.sidebar.collapsed .sidebar-footer { padding: 10px 6px 0; text-align: center; }
.sidebar.collapsed .sidebar-footer .user { display: none; }
.sidebar.collapsed .sidebar-footer .sair { justify-content: center; }

/* rotulos de texto ao lado dos icones do menu - escondidos no modo recolhido */
.label { white-space: nowrap; }
.sidebar.collapsed .label { display: none; }

.content { flex: 1; min-width: 0; padding: 20px 28px 40px; }
.content-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.breadcrumb { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }
.breadcrumb b { color: var(--text-secondary); }
.page-title { font-size: 19px; font-weight: 800; margin: 0; }

.btn-secondary {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 12.5px;
  cursor: pointer;
}
.btn-secondary:hover { color: var(--text-primary); }

/* ------------------------------------------------------------------ */
/* Tela de login                                                       */
/* ------------------------------------------------------------------ */
.brand-panel {
  flex: 1 1 46%;
  max-width: 560px;
  background: radial-gradient(circle at 15% 15%, var(--sidebar-bg-2) 0%, var(--sidebar-bg) 55%, #1b2050 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px 50px;
  position: relative;
  overflow: hidden;
}
.brand-panel::before, .brand-panel::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
}
.brand-panel::before { width: 340px; height: 340px; top: -120px; right: -100px; }
.brand-panel::after { width: 240px; height: 240px; bottom: -80px; left: -60px; background: rgba(245, 227, 25, 0.06); }
.brand-panel .dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.09) 1.4px, transparent 1.4px);
  background-size: 22px 22px;
  opacity: 0.5;
}
.brand-content { position: relative; z-index: 2; text-align: center; max-width: 360px; }
.brand-content img { width: 250px; margin-bottom: 22px; }
.brand-content h2 { font-size: 17px; font-weight: 700; margin: 0 0 10px; color: #fff; }
.brand-content p { font-size: 13.5px; line-height: 1.55; color: rgba(255, 255, 255, 0.72); margin: 0; }

.form-panel {
  flex: 1 1 54%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--page);
}
.login-card { width: 100%; max-width: 360px; }
.login-card .mobile-logo { display: none; }
.login-card h1 { font-size: 22px; font-weight: 800; margin: 0 0 4px; }
.login-card .welcome-sub { font-size: 13px; color: var(--text-muted); margin: 0 0 28px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--text-secondary); margin-bottom: 6px; }
.input-wrap { position: relative; }
.input-wrap .field-ico {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--text-muted);
  pointer-events: none;
}
.input-wrap input {
  width: 100%;
  font-size: 14px;
  padding: 12px 14px 12px 38px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.input-wrap input:focus {
  outline: none;
  border-color: var(--brand-navy);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-navy) 15%, transparent);
}

.login-btn {
  width: 100%;
  margin-top: 6px;
  background: var(--brand-navy);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 13px;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--brand-navy) 30%, transparent);
}
.login-btn:hover { filter: brightness(1.08); }
.login-btn:disabled { opacity: 0.7; cursor: default; }

.login-error {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--status-critical);
  background: color-mix(in srgb, var(--status-critical) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--status-critical) 25%, transparent);
  border-radius: 8px;
  padding: 8px 11px;
}

.login-foot { margin-top: 26px; font-size: 11.5px; color: var(--text-muted); text-align: center; }

@media (max-width: 760px) {
  .brand-panel { display: none; }
  .form-panel {
    flex: 1 1 100%;
    align-items: flex-start;
    padding: 44px 24px 40px;
    background-image:
      radial-gradient(rgba(255, 255, 255, 0.09) 1.4px, transparent 1.4px),
      radial-gradient(circle at 20% 10%, var(--sidebar-bg-2) 0%, var(--sidebar-bg) 55%, #1b2050 100%);
    background-size: 22px 22px, 100% 100%;
    min-height: 100vh;
  }
  .login-card .mobile-logo { display: block; text-align: center; margin-bottom: 30px; }
  .login-card .mobile-logo img { width: 170px; }
  .card-inner {
    background: var(--surface);
    border-radius: 18px;
    padding: 26px 22px 24px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  }
}

.page { display: none; }
.page.active { display: block; }

.mock-banner,
.filtro-aviso {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--brand-yellow-tint);
  border: 1px solid color-mix(in srgb, var(--brand-yellow-ink) 40%, var(--border));
  color: var(--text-primary);
  font-size: 12.5px;
  border-radius: 8px;
  padding: 7px 12px;
  margin-bottom: 12px;
}
.mock-banner b,
.filtro-aviso b { color: var(--brand-yellow-ink); }

.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.atualizado-em {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.op-filtro {
  position: relative;
}
.op-filtro-painel {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  padding: 8px 12px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
}
.op-filtro-painel[hidden] { display: none; }
.op-filtro-painel label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
}
.period-select {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 10px;
  cursor: pointer;
}
.period-custom {
  display: flex;
  align-items: center;
  gap: 6px;
}
.period-custom[hidden] {
  display: none;
}
.period-custom-ate {
  font-size: 12px;
  color: var(--text-muted);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.stat-icon {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon.navy { background: var(--brand-navy-tint); color: var(--brand-navy-ink); }
.stat-icon.yellow { background: var(--brand-yellow-tint); color: var(--brand-yellow-ink); }
.stat-icon svg { width: 16px; height: 16px; }

.stat-body { min-width: 0; }
.stat-tile .label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}
.stat-tile .value {
  font-size: 19px;
  font-weight: 800;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stat-tile .delta {
  font-size: 11.5px;
  margin-top: 1px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 3px;
}
.stat-tile .delta.good { color: var(--success-text); }
.stat-tile .delta.bad { color: var(--status-critical); }
.stat-tile .delta .arrow { font-size: 10px; }
.stat-tile .aguardando-nota {
  font-size: 11px;
  margin-top: 3px;
  color: var(--text-muted);
}
.stat-tile .aguardando-nota[hidden] { display: none; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px 14px;
  margin-bottom: 10px;
}
.card h2 {
  font-size: 13.5px;
  font-weight: 700;
  margin: 0 0 1px;
}
.card .card-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin: 0 0 8px;
}

/* WhatsApp (UazAPI) */
.wa-card { padding: 0; overflow: hidden; }
.wa-layout { display: grid; grid-template-columns: 260px 1fr; height: 560px; }
.wa-lista-coluna {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  min-height: 0;
}
.wa-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.wa-tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.wa-tab-icone { font-size: 16px; line-height: 1; filter: grayscale(1); opacity: 0.55; }
.wa-tab:hover { background: var(--surface-2); }
.wa-tab.active { border-bottom-color: var(--brand-navy); }
.wa-tab.active .wa-tab-icone { filter: none; opacity: 1; }
.wa-tab-count {
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 10px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}
.wa-tab.active .wa-tab-count { background: var(--brand-navy-tint); color: var(--brand-navy); }
.wa-lista {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.wa-conversa-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.wa-conversa-item:hover { background: var(--surface-2); }
.wa-conversa-item.active { background: var(--brand-navy-tint); }
.wa-conversa-item .wa-conversa-texto { flex: 1; min-width: 0; }
.wa-conversa-item .wa-nome { font-weight: 600; font-size: 12.5px; margin-bottom: 2px; }
.wa-conversa-item .wa-preview {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wa-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.wa-avatar.sm { width: 26px; height: 26px; }
.wa-avatar-clicavel { cursor: zoom-in; }

/* Bolinha no canto da foto indicando o canal (WhatsApp verde / Messenger
   azul) - pedido do Caio em 17/09/2026, quando decidimos que as conversas
   dos dois canais ficam juntas na mesma lista. */
.wa-avatar-wrap { position: relative; display: inline-flex; flex-shrink: 0; }
.wa-canal-badge {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
}
.wa-canal-badge svg { display: block; }
.wa-canal-badge.whatsapp { background: #25d366; }
.wa-canal-badge.messenger { background: #0084ff; }
.wa-canal-badge.instagram { background: radial-gradient(circle at 30% 110%, #ffdb8c 0%, #ee2a7b 45%, #6228d7 90%); }

.wa-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  cursor: zoom-out;
}
/* BUG CORRIGIDO em 17/09/2026: sem essa regra, o "display: flex" acima tem a
   mesma especificidade do "display: none" que o navegador aplica sozinho pro
   atributo "hidden", e como a nossa regra vem depois, ela vencia e o
   lightbox ficava visivel cobrindo a tela inteira mesmo sem clicar em
   nenhuma foto (o Caio reportou a tela toda escurecida/travada). */
.wa-lightbox[hidden] { display: none; }
.wa-lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.wa-badge-naolidas {
  background: var(--brand-navy);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  flex-shrink: 0;
}
.wa-chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.wa-chat-topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.wa-chat-header {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 13px;
  min-width: 0;
  flex: 1;
}
.wa-chat-header span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wa-mensagens {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface-2);
}
.wa-bubble {
  max-width: 70%;
  padding: 8px 11px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}
.wa-bubble.recebida {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
}
.wa-bubble.enviada {
  align-self: flex-end;
  background: var(--brand-navy);
  color: #fff;
}
.wa-bubble .wa-hora {
  display: block;
  font-size: 10px;
  margin-top: 3px;
  opacity: 0.65;
}
.wa-bubble img.wa-midia-imagem {
  display: block;
  max-width: 240px;
  max-height: 240px;
  border-radius: 8px;
  margin-bottom: 4px;
  cursor: pointer;
}
.wa-bubble audio.wa-midia-audio { width: 230px; margin-bottom: 2px; }
.wa-bubble .wa-midia-arquivo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  text-decoration: underline;
}
.wa-bubble .wa-midia-carregar {
  background: none;
  border: 1px solid currentColor;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  color: inherit;
  opacity: 0.85;
}
.wa-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}
.wa-input-row input {
  flex: 1;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 12.5px;
}
.wa-input-row input:focus { outline: none; border-color: var(--brand-navy); }

.wa-anexo-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.wa-anexo-preview-conteudo {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}
.wa-anexo-preview-conteudo img {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}
.wa-anexo-preview-conteudo span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wa-anexo-remover {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.wa-anexo-remover:hover { color: var(--status-critical); }

.wa-btn-icone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 10px;
  color: var(--text-secondary);
}
.wa-btn-icone svg { display: block; flex-shrink: 0; }
#wa-gravar-tempo { font-size: 11px; font-weight: 600; white-space: nowrap; }

#wa-gravar-btn.wa-gravando {
  background: var(--status-critical);
  border-color: var(--status-critical);
  color: #fff;
  animation: wa-pulso 1.2s ease-in-out infinite;
}
@keyframes wa-pulso {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.chart-wrap { position: relative; }
.chart-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }

.tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--text-primary);
  color: var(--page);
  font-size: 12px;
  padding: 6px 9px;
  border-radius: 6px;
  transform: translate(-50%, -100%);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.1s ease;
  z-index: 5;
}
.tooltip.visible { opacity: 1; }

/* Listas ranqueadas (Margem por Departamento / Produto) */
.ranked-list { display: flex; flex-direction: column; gap: 5px; }
.ranked-row {
  display: grid;
  grid-template-columns: 118px 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
}
.ranked-row .rk-label {
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ranked-row .rk-track {
  background: var(--surface-2);
  border-radius: 4px;
  height: 16px;
  position: relative;
  overflow: hidden;
}
.ranked-row .rk-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: var(--brand-navy);
  border-radius: 4px;
}
.ranked-row .rk-value {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  text-align: right;
  min-width: 72px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 620px) {
  .two-col { grid-template-columns: 1fr; }
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data-table th, table.data-table td {
  text-align: left;
  padding: 6px 6px;
  border-bottom: 1px solid var(--grid);
}
table.data-table th {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
}
table.data-table td.num { font-variant-numeric: tabular-nums; text-align: right; }
.table-scroll { overflow-x: auto; }

table.data-table tr.linha-divisor-classe td {
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  padding: 5px 6px;
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}
.badge.warning { background: color-mix(in srgb, var(--brand-yellow-ink) 22%, transparent); color: var(--brand-yellow-ink); }
.badge.critical { background: color-mix(in srgb, var(--status-critical) 18%, transparent); color: var(--status-critical); }
.badge.classe-a { background: var(--status-good-tint); color: #175c17; }
.badge.classe-b { background: var(--brand-yellow-tint); color: var(--brand-yellow-ink); }
.badge.classe-c { background: var(--surface-2); color: var(--text-secondary); }

footer.app-footer {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ------------------------------------------------------------------ */
/* Metas (dia e mes) - velocimetro                                     */
/* ------------------------------------------------------------------ */
.gauge-box { text-align: center; margin-bottom: 4px; }
.gauge-box .chart-wrap { max-width: 220px; margin: 0 auto; }
.gauge-pct { font-size: 26px; font-weight: 800; color: var(--text-primary); margin-top: -6px; }
.gauge-pct .sign { font-size: 14px; font-weight: 700; }
.gauge-legenda { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; margin-bottom: 6px; }

.meta-linha { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 3px; }
.meta-linha .rotulo { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.meta-linha .valor { font-size: 14.5px; font-weight: 800; font-variant-numeric: tabular-nums; }
.meta-linha .valor.navy { color: var(--brand-navy); }
.meta-linha .valor.muted { color: var(--text-muted); font-weight: 700; }

.meta-linha.projecao { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
.meta-linha.projecao .rotulo { color: var(--brand-navy); }
.meta-linha.projecao .valor { color: var(--brand-navy); font-size: 15.5px; }

.meta-callout {
  font-size: 11.5px;
  padding: 7px 10px;
  border-radius: 8px;
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
  margin-bottom: 10px;
  font-weight: 600;
}
.meta-callout.falta { background: var(--brand-yellow-tint); color: var(--brand-yellow-ink); }
.meta-callout.batida { background: var(--status-good-tint); color: #175c17; }

.meta-lojas { display: flex; flex-direction: column; margin-top: 4px; }
.meta-loja-row { padding: 6px 0; border-bottom: 1px solid var(--border); }
.meta-loja-row:last-child { border-bottom: none; padding-bottom: 0; }
.meta-loja-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.meta-loja-top .nome { font-size: 12px; font-weight: 700; color: var(--text-primary); }
.meta-loja-top .valores { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.meta-loja-top .valores b { color: var(--text-secondary); font-weight: 700; }
.meta-loja-bottom { display: flex; align-items: center; gap: 8px; }
.meta-loja-bottom .track { flex: 1; background: var(--surface-2); border-radius: 999px; height: 7px; overflow: hidden; }
.meta-loja-bottom .fill { display: block; height: 100%; border-radius: 999px; background: var(--status-good); }
.meta-loja-bottom .fill.amarela { background: var(--brand-yellow); }
.meta-loja-bottom .fill.vermelha { background: var(--status-serious); }
.meta-loja-bottom .pct { width: 34px; text-align: right; font-weight: 700; color: var(--text-primary); font-size: 11px; }

.meta-loja-status {
  margin-top: 5px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 6px;
  display: inline-block;
}
.meta-loja-status.falta { background: var(--brand-yellow-tint); color: var(--brand-yellow-ink); }
.meta-loja-status.batida { background: var(--status-good-tint); color: #175c17; }
.meta-loja-status.neutra { background: var(--surface-2); color: var(--text-muted); }

/* ------------------------------------------------------------------ */
/* Previsibilidade do mes + Observacoes                                */
/* ------------------------------------------------------------------ */
.collapsed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.collapsed-row .label {
  font-size: 13.5px;
  font-weight: 700;
}
.collapsed-row .label .icon { margin-right: 6px; }

.toolbar-mes {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.hist-note {
  font-size: 11.5px;
  color: var(--text-muted);
  margin: 0;
}

.semanas-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.semana-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.semana-pct { font-size: 13px; font-weight: 800; }
.semana-pct.fraca { color: var(--status-serious); }
.semana-pct.forte { color: var(--status-good); }
.semana-pct.neutra { color: var(--text-secondary); font-weight: 700; }
.bar-track {
  width: 100%;
  height: 110px;
  background: var(--surface-2);
  border-radius: 8px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.bar-fill { width: 100%; border-radius: 8px 8px 0 0; min-height: 3px; }
.bar-fill.navy { background: var(--brand-navy); }
.bar-fill.fraca { background: var(--status-serious); }
.bar-fill.forte { background: var(--brand-navy); }
.semana-label { font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.semana-label-row { display: flex; align-items: center; gap: 4px; }
.pin-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: var(--brand-yellow);
  border-radius: 999px;
  font-size: 10px;
  cursor: default;
}

.callouts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.callout {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 12.5px;
}
.callout.fraca { background: var(--status-serious-tint); color: #8a3d22; }
.callout.forte { background: var(--status-good-tint); color: #175c17; }
.callout .emoji { font-size: 15px; line-height: 1.3; }
.callout b { display: block; margin-bottom: 1px; }

/* Observacoes */
.nota-card {
  margin-bottom: 14px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.nota-card h3 { font-size: 12.5px; margin: 0 0 8px; }
.nota-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12px;
  margin-bottom: 8px;
}
.nota-item .cat-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-yellow-tint);
  flex-shrink: 0;
  font-size: 12px;
}
.nota-item .nota-body { flex: 1; min-width: 0; }
.nota-item .meta { color: var(--text-muted); font-size: 10.5px; margin-top: 2px; }
.nota-item .btn-remover-nota {
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 2px 4px;
  flex-shrink: 0;
}
.nota-item .btn-remover-nota:hover { color: var(--status-critical); }
.nota-vazia { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.btn-add-nota {
  border: 1px dashed var(--brand-navy);
  background: transparent;
  color: var(--brand-navy);
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
}

.nota-form {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nota-form[hidden] {
  display: none;
}
.nota-form-row { display: flex; gap: 8px; flex-wrap: wrap; }
.nota-form-row > * { flex: 1; min-width: 110px; }
.nota-form label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 3px;
}
.nota-form select,
.nota-form input,
.nota-form textarea {
  width: 100%;
  font-size: 12.5px;
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-family: inherit;
}
.nota-form textarea { resize: vertical; min-height: 50px; }
.nota-form-actions { display: flex; gap: 8px; justify-content: flex-end; }
.nota-form-erro { font-size: 11.5px; color: var(--status-critical); }

/* Comparativo por ano (grafico agrupado, versao "com valores") */
.comp-anos-row {
  display: flex;
  gap: 18px;
  align-items: flex-end;
  height: 170px;
  margin-bottom: 6px;
  padding: 0 4px;
}
.comp-semana-grupo { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.comp-barras {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 140px;
  width: 100%;
  justify-content: center;
}
.comp-barra-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  width: 26px;
}
.comp-valor { font-size: 9.5px; font-weight: 700; color: var(--text-secondary); margin-bottom: 3px; white-space: nowrap; }
.comp-barra { width: 100%; border-radius: 3px 3px 0 0; min-height: 2px; }
.comp-semana-label { font-size: 12px; font-weight: 700; color: var(--text-secondary); margin-top: 8px; }

/* ------------------------------------------------------------------ */
/* Horarios e dias de pico (grafico de barras)                         */
/* ------------------------------------------------------------------ */
.barras-row { display: flex; gap: 8px; margin-bottom: 6px; }
.barra-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.barra-pct { font-size: 11.5px; font-weight: 800; white-space: nowrap; }
.barra-pct.fraca { color: var(--status-serious); }
.barra-pct.forte { color: var(--status-good); }
.barra-pct.neutra { color: var(--text-secondary); font-weight: 700; }
.barra-track {
  width: 100%;
  height: 100px;
  background: var(--surface-2);
  border-radius: 6px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.barra-fill { width: 100%; border-radius: 6px 6px 0 0; min-height: 3px; }
.barra-fill.navy { background: var(--brand-navy); }
.barra-fill.fraca { background: var(--status-serious); }
.barra-fill.forte { background: var(--status-good); }
.barra-label { font-size: 11.5px; font-weight: 700; color: var(--text-secondary); }

/* ------------------------------------------------------------------ */
/* Modo TV - tela cheia pra ficar num monitor/TV do escritorio,        */
/* atualizando sozinha, sem menu nem botoes (so numeros e graficos).   */
/* ------------------------------------------------------------------ */
body.tv-mode .sidebar,
body.tv-mode .content-header,
body.tv-mode .panel-toolbar,
body.tv-mode footer.app-footer,
body.tv-mode .mock-banner,
body.tv-mode .filtro-aviso {
  display: none !important;
}
body.tv-mode .content {
  max-width: 100%;
  padding: 28px 40px 40px;
}
body.tv-mode .stat-row { gap: 16px; margin-bottom: 18px; }
body.tv-mode .stat-tile { padding: 18px 20px; gap: 14px; }
body.tv-mode .stat-tile .label { font-size: 13px; }
body.tv-mode .stat-tile .value { font-size: 30px; }
body.tv-mode .stat-tile .delta { font-size: 14px; }
body.tv-mode .stat-icon { width: 40px; height: 40px; }
body.tv-mode .stat-icon svg { width: 22px; height: 22px; }
body.tv-mode .card { padding: 18px 22px 20px; }
body.tv-mode .card h2 { font-size: 18px; }
body.tv-mode .card .card-sub { font-size: 13.5px; }
body.tv-mode .two-col { gap: 18px; }
body.tv-mode table.data-table { font-size: 15px; }
body.tv-mode .ranked-row { font-size: 14px; }
body.tv-mode .legend { font-size: 13px; }
body.tv-mode .gauge-pct { font-size: 34px; }
body.tv-mode .gauge-legenda { font-size: 13px; }
body.tv-mode .meta-linha .rotulo,
body.tv-mode .meta-linha .valor { font-size: 15px; }
body.tv-mode .meta-callout { font-size: 13.5px; }
body.tv-mode .meta-loja-row { font-size: 13px; }
body.tv-mode .meta-loja-status { font-size: 12.5px; padding: 4px 8px; }

/* ------------------------------------------------------------------ */
/* Financeiro / DRE                                                    */
/* ------------------------------------------------------------------ */
.dre-mes-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dre-mes-label {
  font-weight: 700;
  font-size: 13.5px;
  min-width: 110px;
  text-align: center;
}
.controle-caixa-lock { font-size: 11px; cursor: help; }

table.dre-table tr.dre-grupo-row td {
  font-weight: 700;
  background: var(--surface-2);
  border-top: 1px solid var(--grid);
}
table.dre-table tr.dre-grupo-row.dre-grupo-recolhivel {
  cursor: pointer;
}
table.dre-table tr.dre-grupo-row.dre-grupo-recolhivel:hover td {
  background: color-mix(in srgb, var(--surface-2) 60%, var(--brand-navy) 6%);
}
.dre-expand-seta-grupo {
  display: inline-block;
  width: 12px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 400;
}
table.dre-table tr.dre-totalizador-row td {
  font-weight: 800;
  background: color-mix(in srgb, var(--brand-navy) 8%, transparent);
  border-top: 1.5px solid var(--brand-navy);
  border-bottom: 1.5px solid var(--brand-navy);
}
table.dre-table tr.dre-subgrupo-row {
  cursor: pointer;
}
table.dre-table tr.dre-subgrupo-row:hover td { background: var(--surface-2); }
table.dre-table tr.dre-subgrupo-row td.dre-linha-nome {
  padding-left: 22px;
  color: var(--text-secondary);
}
.dre-expand-seta {
  display: inline-block;
  width: 12px;
  color: var(--text-muted);
  font-size: 10px;
}
table.dre-table tr.dre-lancamentos-row td {
  background: var(--page);
  padding: 8px 10px 10px 34px;
}
.dre-lancamentos-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 620px) {
  .dre-lancamentos-grid { grid-template-columns: 1fr; }
}
.dre-lancamentos-grid h4 {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 4px;
}
.dre-lancamentos-lista {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.dre-lancamento-item {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 4px 8px;
  font-size: 12px;
  border-bottom: 1px solid var(--grid);
}
.dre-lancamento-item:last-child { border-bottom: none; }
.dre-lanc-data { color: var(--text-muted); flex-shrink: 0; width: 34px; }
.dre-lanc-obs { flex: 1; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dre-lanc-valor { font-variant-numeric: tabular-nums; font-weight: 600; flex-shrink: 0; }
.dre-lancamentos-vazio { font-size: 12px; color: var(--text-muted); padding: 6px 8px; margin: 0; }
