/* ---------------------------------------------------------------- Botões e chips */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 14.5px;
  white-space: nowrap;
  transition: transform .15s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease), opacity .2s;
  text-decoration: none !important;
}
.btn:active { transform: scale(.97); }
.btn[disabled], .btn.disabled { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--acao); color: var(--acao-texto); box-shadow: 0 6px 18px rgba(44, 119, 44, .28), inset 0 1px 0 rgba(255, 255, 255, .22); }
.btn-primary:hover { background: var(--acao-forte); }
.btn-glass {
  background: var(--surface);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  backdrop-filter: blur(18px) saturate(170%);
  border-color: var(--glass-border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .06), inset 0 1px 0 var(--glass-highlight);
  color: var(--text);
}
.btn-glass:hover { background: var(--surface-strong); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-sunken); color: var(--text); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-sm { min-height: 34px; padding: 0 13px; font-size: 13.5px; }
.btn-icon { width: 40px; min-height: 40px; padding: 0; }
.btn-icon.btn-sm { width: 34px; min-height: 34px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--surface);
  -webkit-backdrop-filter: blur(16px) saturate(170%);
  backdrop-filter: blur(16px) saturate(170%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .05), inset 0 1px 0 var(--glass-highlight);
  font-size: 14px;
  font-weight: 550;
  transition: background .2s, transform .15s var(--ease), border-color .2s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip:active { transform: scale(.96); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  background: var(--surface-sunken);
  color: var(--text-2);
}
.pill.verde { background: var(--accent-soft); color: var(--accent); }
.pill.roxo { background: var(--certifica-soft); color: var(--certifica); }
.pill.ambar { background: var(--warn-soft); color: var(--warn); }
.pill.vermelho { background: var(--danger-soft); color: var(--danger); }

/* ---------------------------------------------------------------- Barra superior */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-radius: 0;
  border-width: 0 0 1px;
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  height: var(--topbar-h);
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; letter-spacing: -.01em; font-size: 17px; }
.brand:hover { text-decoration: none; }
.brand-logo { height: 26px; width: auto; display: block; }
/* Logotipo preto no tema claro; verde no escuro (sistema ou escolha manual). */
.brand-logo.logo-escuro { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-logo.logo-claro { display: none; }
  :root:not([data-theme="light"]) .brand-logo.logo-escuro { display: block; }
}
:root[data-theme="dark"] .brand-logo.logo-claro { display: none; }
:root[data-theme="dark"] .brand-logo.logo-escuro { display: block; }
.topbar-actions { display: flex; align-items: center; gap: 10px; min-width: 0; }
@media (max-width: 440px) {
  .topbar-actions { gap: 6px; }
  #ia-status span { display: none; }  /* só o ícone da IA em telas estreitas */
  #ia-status { padding: 6px; }
}

.theme-toggle {
  position: relative;
  width: 68px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--surface-sunken);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .08);
  padding: 0;
}
.theme-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 28px;
  height: 26px;
  border-radius: 999px;
  background: var(--surface-strong);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15), inset 0 1px 0 var(--glass-highlight);
  transition: transform .35s var(--ease);
}
.theme-icon { position: absolute; top: 7px; width: 18px; height: 18px; display: grid; place-items: center; transition: color .3s; }
.theme-icon svg { width: 18px; height: 18px; fill: currentColor; }
.theme-sun { left: 8px; color: #D59A1E; }
.theme-moon { right: 8px; color: var(--text-3); }
.escuro .theme-knob { transform: translateX(32px); }
.escuro .theme-sun { color: var(--text-3); }
.escuro .theme-moon { color: #9DB7FF; }
