/* NÜVA Reviews — estilo próprio, alinhado à identidade da clínica. */

:root {
  --graphite: #1f1f1f;
  --graphite-soft: #3d3d3d;
  --muted: #6a6a6a;
  --line: rgba(0, 0, 0, 0.09);
  --off: #f7f5f0;
  --white: #fff;
  --gold: #b89a63;
  --gold-dark: #8a7048;
  --gold-soft: #f0e4cc;
  --red: #a33a3a;
  --green: #3d7a4f;
  --radius: 10px;
  --font: "Josefin Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--graphite);
  background: var(--off);
  -webkit-font-smoothing: antialiased;
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: rgba(0, 0, 0, 0.05);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ---------------------------------------------------------------- login */

.auth {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: linear-gradient(160deg, var(--off), #efe9df);
  padding: 24px;
}

.auth__card {
  width: 100%;
  max-width: 380px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 40px 32px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.06);
}

.auth__title {
  margin: 0 0 6px;
  font-size: 1.6rem;
  font-weight: 300;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
}

.auth__sub {
  margin: 0 0 28px;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.03em;
}

/* -------------------------------------------------------------- topbar */

/*
 * Barra fixa em 3 blocos, sempre na mesma ordem:
 *   [marca]  [miolo: indicadores · empurra para a direita]  [navegação + ações]
 * Usar flex (e não grid com áreas nomeadas) evita colunas vazias: em
 * Ajustes não existe bloco de indicadores, e com grid isso deslocaria a
 * navegação. Aqui o miolo simplesmente não aparece e nada mais se move.
 */
/*
 * `scrollbar-gutter: stable` reserva o espaço da barra de rolagem em TODAS
 * as páginas. Sem isso, Ajustes (que rola) e Avaliações (que não rola)
 * ficavam com larguras úteis diferentes e a barra de navegação "pulava"
 * alguns pixels ao trocar de tela.
 */
html {
  scrollbar-gutter: stable;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--graphite);
  color: var(--white);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  transition: box-shadow 0.25s ease;
}

/* Sombra só quando a página é rolada (aplica-se via JS). */
.topbar.is-scrolled { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22); }

.topbar__inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.topbar__brand {
  flex: 0 0 auto;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-soft);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.topbar__brand:hover { color: #fff; }

/*
 * Indicadores: ocupam o espaço livre e empurram navegação/ações para a
 * direita. Se o bloco não existir (Ajustes), quem empurra é o
 * `margin-left: auto` do grupo de navegação.
 */
.topbar__stats {
  flex: 1 1 auto;
  display: flex;
  gap: 20px;
  align-items: center;
  min-width: 0;
  overflow: hidden;
}

.stat {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
  line-height: 1.1;
}

.stat strong {
  display: block;
  font-size: 1rem;
  font-weight: 400;
  color: var(--white);
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

/* Navegação + ações formam um grupo alinhado à direita.
   `margin-left: auto` empurra o grupo inteiro quando não há indicadores
   (Ajustes) e funciona junto com `flex: 1` dos indicadores (Avaliações). */
.topbar__nav {
  flex: 0 0 auto;
  margin-left: auto;
  display: flex;
  gap: 2px;
  align-items: center;
}

.topbar__actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar__nav a {
  position: relative;
  color: rgba(255, 255, 255, 0.66);
  text-decoration: none;
  font-size: 0.68rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 7px 13px;
  border-radius: 5px;
  white-space: nowrap;
  transition: color 0.18s ease, background-color 0.18s ease;
}

.topbar__nav a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

.topbar__nav a.is-active {
  background: rgba(184, 154, 99, 0.2);
  color: var(--gold-soft);
}

/* Sublinhado dourado animado no item ativo (acompanha o hover). */
.topbar__nav a::after {
  content: '';
  position: absolute;
  left: 13px;
  right: 13px;
  bottom: 3px;
  height: 1px;
  background: var(--gold-soft);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.22s ease;
}

.topbar__nav a.is-active::after { transform: scaleX(1); }

.dot-warn {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e0a33a;
  margin-left: 6px;
  vertical-align: middle;
  animation: dot-pulse 2.4s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 163, 58, 0.5); }
  50%      { box-shadow: 0 0 0 4px rgba(224, 163, 58, 0); }
}

/* --------------------------------------------------------- actionbar */

.actionbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  padding: 16px 18px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.actionbar__item { margin: 0; }

.btn--gold {
  background: var(--gold);
  border-color: var(--gold);
  color: #fff;
}

.btn--gold:hover {
  background: var(--gold-dark);
  border-color: var(--gold-dark);
  color: #fff;
}

.badge {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 99px;
  white-space: nowrap;
}

.badge--ok   { background: rgba(61, 122, 79, 0.25); color: #a8d8b4; }
.badge--warn { background: rgba(184, 154, 99, 0.25); color: var(--gold-soft); }

/* ---------------------------------------------------------------- wrap */

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 22px;
}

.card__title {
  margin: 0 0 8px;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.card__hint {
  margin: 0 0 16px;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ------------------------------------------------------------- alerts */

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin: 0 0 18px;
  border: 1px solid transparent;
}

.alert--ok    { background: #eef7f0; border-color: #cfe7d6; color: #245731; }
.alert--error { background: #fbf0f0; border-color: #f0d4d4; color: var(--red); }
.alert--info  { background: #fdf8ee; border-color: #f0e2c8; color: var(--gold-dark); }

/* -------------------------------------------------------------- forms */

/* Qualquer campo de texto entra aqui. A lista por `type` deixava escapar
   os tipos menos usados (text, url, search...), que apareciam com a borda
   cinza do sistema no meio de um formulário estilizado. Exclui apenas os
   tipos que não são caixa de texto: checkbox, radio, file, range, color,
   submit e botões. */
textarea,
select,
input:not([type]),
input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="tel"],
input[type="number"],
input[type="search"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"],
input[type="week"] {
  width: 100%;
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--graphite);
  background: var(--white);
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 8px;
  padding: 11px 13px;
  resize: vertical;
}

textarea:focus,
input:focus,
select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184, 154, 99, 0.16);
}

textarea[readonly] {
  background: #faf9f7;
  color: var(--muted);
}

.field {
  display: block;
  margin-bottom: 18px;
}

.field span {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

/* ------------------------------------------------------------ buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--graphite);
  background: var(--white);
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 6px;
  padding: 11px 20px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.btn:hover { border-color: var(--gold); color: var(--gold-dark); }
.btn--sm { padding: 7px 13px; font-size: 0.66rem; }
.btn--primary { background: var(--graphite); border-color: var(--graphite); color: var(--white); }
.btn--primary:hover { background: var(--gold-dark); border-color: var(--gold-dark); color: var(--white); }
.btn--danger { color: var(--red); border-color: rgba(163, 58, 58, 0.35); }
.btn--danger:hover { background: var(--red); border-color: var(--red); color: var(--white); }
.btn--ghost { background: transparent; border-color: rgba(255, 255, 255, 0.28); color: rgba(255, 255, 255, 0.85); }
.btn--ghost:hover { border-color: var(--gold-soft); color: var(--gold-soft); }

/* ------------------------------------------------------------ filters */

.filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filters__tab {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 99px;
  border: 1px solid transparent;
}

.filters__tab:hover { background: rgba(0, 0, 0, 0.04); }

.filters__tab.is-active {
  background: var(--white);
  border-color: var(--line);
  color: var(--graphite);
}

/* ------------------------------------------------------------- review */

.review {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 14px;
  scroll-margin-top: 90px;
}

.review--focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184, 154, 99, 0.18);
}

.review__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.review__avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--off);
  border: 1px solid var(--line);
  font-size: 0.9rem;
  color: var(--gold-dark);
  flex-shrink: 0;
}

.review__meta { flex: 1; min-width: 0; }

.review__author {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
}

.review__rating {
  display: flex;
  align-items: center;
  gap: 1px;
  font-size: 0.8rem;
  color: #d8d2c6;
}

.star--on { color: var(--gold); }

.review__date {
  margin-left: 8px;
  font-size: 0.7rem;
  color: var(--muted);
}

.pill {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 99px;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.05);
  color: var(--muted);
}

.pill--novo       { background: #fdf3e3; color: #96702e; }
.pill--pendente   { background: #eef2fb; color: #47639e; }
.pill--rascunho   { background: #eef2fb; color: #47639e; }
.pill--aprovado   { background: #eaf6ee; color: var(--green); }
.pill--publicado  { background: #e7f3ea; color: var(--green); }
.pill--respondido { background: #e7f3ea; color: var(--green); }

.review__text {
  margin: 0 0 14px;
  padding: 0 0 0 14px;
  border-left: 2px solid var(--gold-soft);
  font-size: 0.87rem;
  line-height: 1.7;
  color: var(--graphite-soft);
}

.muted { color: var(--muted); }

/* Selo de origem Google */
.src {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  margin-left: 5px;
  border-radius: 50%;
  background: #eaf1fe;
  color: #3f6ed4;
  font-size: 0.55rem;
  font-weight: 600;
  vertical-align: 1px;
}

/* -------------------------------------------------------------- draft */

.draft {
  background: var(--off);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
}

.draft--generate {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.draft--generate select {
  width: auto;
  min-width: 170px;
  font-size: 0.78rem;
  padding: 8px 11px;
}

.draft__label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.draft__label small {
  font-size: 0.66rem;
  letter-spacing: 0;
  text-transform: none;
  color: #9a9a9a;
}

.draft textarea { min-height: 92px; }

.draft__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* ------------------------------------------------------------ details */

.review__danger {
  margin-top: 10px;
  font-size: 0.72rem;
  color: var(--muted);
}

.review__danger summary {
  cursor: pointer;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.66rem;
}

.review__danger form { margin-top: 8px; }

.danger__body {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.danger__body form { margin: 0; }

.danger__note {
  margin: 12px 0 0;
  padding: 10px 12px;
  background: var(--off);
  border-left: 2px solid var(--gold-soft);
  border-radius: 4px;
  line-height: 1.6;
}

.danger__note a { color: var(--gold-dark); }

/* ------------------------------------------------------- publicado */

.draft--published { border-left: 3px solid var(--green); }

.draft--readonly p {
  margin: 8px 0 0;
  font-size: 0.87rem;
  line-height: 1.7;
  color: var(--graphite-soft);
}

/* ---------------------------------------------------------- ajustes */

.conn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 16px;
  background: var(--off);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.conn__info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.conn__info small {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
}

.conn__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(61, 122, 79, 0.16);
  flex-shrink: 0;
}

.conn__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.conn__actions form { margin: 0; }

.locs {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.locs__item label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--off);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.locs__item label:hover { border-color: var(--gold); }

.locs__item input { margin-top: 3px; }

.locs__item strong { display: block; font-size: 0.88rem; font-weight: 500; }
.locs__item small { display: block; color: var(--muted); font-size: 0.76rem; }

.card--collapsible details summary {
  cursor: pointer;
  list-style: none;
}

.card--collapsible details summary::-webkit-details-marker { display: none; }

.card--collapsible details summary::before {
  content: '+ ';
  color: var(--gold-dark);
}

.card--collapsible details[open] summary::before { content: '− '; }

.card--collapsible details > form { margin-top: 14px; }

.alert a { color: inherit; font-weight: 500; }

/* --------------------------------------------------------------- misc */

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  background: var(--white);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.foot {
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.7;
}

/* ================================================================
   SISTEMA DE FEEDBACK / UX
   ================================================================ */

/* Botão em processamento: spinner + bloqueio visual e funcional.
   O JS adiciona .is-busy e disabled; o texto original vira "aguarde". */
.btn {
  position: relative;
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    transform 0.12s ease,
    box-shadow 0.18s ease;
}

.btn:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.09);
}

.btn:not(:disabled):active {
  transform: translateY(0) scale(0.985);
  box-shadow: none;
}

.btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.btn:disabled,
.btn[aria-disabled='true'] {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none !important;
  box-shadow: none !important;
}

/* Spinner do botão ocupado */
.btn.is-busy { color: transparent !important; pointer-events: none; }

.btn.is-busy::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  color: var(--graphite);
  animation: spin 0.65s linear infinite;
}

.btn--primary.is-busy::after,
.btn--gold.is-busy::after,
.btn--danger.is-busy::after { color: #fff; }

@keyframes spin { to { transform: rotate(360deg); } }

/* Barra de progresso indeterminada no topo da página (navegação). */
.nf-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, var(--gold), var(--gold-soft));
  z-index: 999;
  transition: width 0.25s ease, opacity 0.3s ease;
  pointer-events: none;
}

.nf-progress.is-done { opacity: 0; }

/* Overlay curto ao submeter (evita duplo clique e dá sensação de ação). */
.nf-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 31, 31, 0.28);
  backdrop-filter: blur(1.5px);
  z-index: 900;
  display: grid;
  place-items: center;
  animation: fade-in 0.18s ease;
  cursor: progress;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.nf-overlay__box {
  background: var(--white);
  border-radius: 12px;
  padding: 22px 28px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
  font-size: 0.85rem;
  color: var(--graphite-soft);
  animation: pop-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}

.nf-spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--gold-soft);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* Alertas: entrada suave e botão de fechar.
   `min-width: 0` é essencial: sem isso o texto solto do alerta não encolhe,
   empurra o botão para fora do card e a página ganha rolagem horizontal. */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  overflow-wrap: anywhere;
  animation: slide-down 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

.alert__close {
  flex: 0 0 auto;
  margin-left: auto;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: inherit;
  opacity: 0.5;
  padding: 0;
  border-radius: 4px;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}

.alert__close:hover { opacity: 1; background: rgba(0, 0, 0, 0.06); }

/* Toast de confirmação de cópia / ações rápidas. */
.nf-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: var(--graphite);
  color: #fff;
  font-size: 0.8rem;
  padding: 11px 18px;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  z-index: 950;
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nf-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.nf-toast__icon { color: var(--gold-soft); font-size: 0.9rem; }

/* Textarea: contador de caracteres e foco mais claro. */
.draft__wrap { position: relative; }

.draft textarea {
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.draft textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184, 154, 99, 0.14);
}

.char-count {
  position: absolute;
  right: 10px;
  bottom: 8px;
  font-size: 0.68rem;
  color: var(--muted);
  background: var(--white);
  padding: 1px 5px;
  border-radius: 3px;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
  transition: color 0.18s ease;
}

.char-count.is-near-limit { color: #b8862a; }
.char-count.is-over-limit { color: var(--red); font-weight: 600; }

/* Estado "alterado, não salvo" — sinaliza edição pendente. */
.draft.is-dirty { border-left: 3px solid var(--gold); }

.draft__actions .btn--save-hint {
  animation: soft-pulse 2s ease-in-out infinite;
}

@keyframes soft-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(184, 154, 99, 0.35); }
  50%      { box-shadow: 0 0 0 5px rgba(184, 154, 99, 0); }
}

/* Aviso ao tentar sair com texto não salvo. */
.nf-unsaved {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff8e6;
  border: 1px solid #e8cf95;
  color: #7a5c1d;
  font-size: 0.78rem;
  padding: 10px 16px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  z-index: 940;
  animation: slide-up 0.25s ease;
}

@keyframes slide-up {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* Filtros: indicador claro de aba ativa + contagem. */
.filters__tab {
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.filters__tab:active { transform: scale(0.98); }

/* Cartão de avaliação: entrada suave e destaque quando focado pela URL. */
.review {
  animation: card-in 0.32s ease backwards;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* Escalona a entrada dos cartões (máx. 8) para não parecer travado. */
.review:nth-of-type(1) { animation-delay: 0.02s; }
.review:nth-of-type(2) { animation-delay: 0.05s; }
.review:nth-of-type(3) { animation-delay: 0.08s; }
.review:nth-of-type(4) { animation-delay: 0.11s; }
.review:nth-of-type(5) { animation-delay: 0.14s; }
.review:nth-of-type(6) { animation-delay: 0.17s; }
.review:nth-of-type(7) { animation-delay: 0.20s; }
.review:nth-of-type(8) { animation-delay: 0.23s; }

/* Cartão que está sendo removido/publicado. */
.review.is-leaving {
  opacity: 0;
  transform: translateX(24px) scale(0.99);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

/* Selo de sucesso sobre o cartão após publicar. */
.review.is-published {
  animation: published-flash 0.9s ease;
}

@keyframes published-flash {
  0%   { border-color: var(--green); box-shadow: 0 0 0 0 rgba(61, 122, 79, 0.3); }
  60%  { border-color: var(--green); box-shadow: 0 0 0 8px rgba(61, 122, 79, 0); }
  100% { border-color: var(--line); box-shadow: none; }
}

/* Acessibilidade: quem prefere menos movimento não recebe animação. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------------------------------------------------- responsividade */

/* Abaixo de 980px os indicadores ficam apertados: some com a média
   primeiro, depois os menos importantes. A barra nunca quebra linha. */
@media (max-width: 980px) {
  .topbar__inner { gap: 16px; }
  .topbar__stats { gap: 14px; }
  .stat--low { display: none; }
}

@media (max-width: 860px) {
  .topbar__stats { gap: 12px; }
  .stat--mid { display: none; }
}

@media (max-width: 760px) {
  /*
   * Duas linhas, sem sobreposição:
   *   linha 1: marca ............... navegação + ações
   *   linha 2: indicadores (roláveis na horizontal)
   * A navegação tem `margin-left:auto`, então ela e o botão Sair ficam
   * sempre colados à direita, na mesma linha da marca.
   */
  .topbar__inner {
    height: auto;
    padding: 9px 14px 8px;
    flex-wrap: wrap;
    align-items: center;
    row-gap: 6px;
    column-gap: 8px;
  }

  .topbar__brand {
    order: 1;
    flex: 0 0 auto;
    font-size: 0.74rem;
    letter-spacing: 0.1em;
  }

  .topbar__nav {
    order: 2;
    margin-left: auto;
    gap: 0;
  }
  .topbar__nav a {
    padding: 5px 8px;
    font-size: 0.6rem;
    letter-spacing: 0.05em;
  }

  .topbar__actions {
    order: 3;
    gap: 6px;
  }
  .topbar__actions .badge,
  .topbar__actions .btn {
    font-size: 0.58rem;
    padding: 4px 7px;
    line-height: 1.3;
  }

  /*
   * O selo "IA: ..." é acessório e volta a empurrar a linha 1 para um
   * terceiro nível em telas pequenas. Ele continua disponível em Ajustes.
   */
  .topbar__actions .badge { display: none; }

  /* Indicadores: faixa própria, largura total, rolagem se necessário. */
  .topbar__stats {
    order: 4;
    flex: 1 1 100%;
    gap: 16px;
    margin-top: 4px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .topbar__stats::-webkit-scrollbar { display: none; }
  .stat { font-size: 0.6rem; }
  .stat strong { font-size: 0.88rem; }

  /* No mobile volta tudo: há espaço na faixa própria. */
  .stat--mid, .stat--low { display: block; }

  .wrap { padding: 20px 16px 48px; }
  .review { padding: 16px; }
  .actionbar { padding: 14px; }
  .actionbar__item, .actionbar .btn { width: 100%; }

  /*
   * Cards de avaliacao no celular:
   * - o cabecalho vira 2 linhas (autor/nota e, abaixo, a data + selo),
   *   porque os 3 blocos nao cabem lado a lado em 375px;
   * - os botoes de acao ocupam a largura toda e viram alvos grandes,
   *   faceis de tocar com o dedo.
   */
  .review__head {
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
  }
  .review__avatar {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
  .review__author { font-size: 0.95rem; }
  .review__rating {
    flex-wrap: wrap;
    gap: 2px;
    font-size: 0.85rem;
  }
  .review__date {
    flex-basis: 100%;
    margin-top: 2px;
    font-size: 0.7rem;
  }
  .review__head .pill {
    margin-left: auto;
    align-self: flex-start;
  }

  /* Botoes de acao empilhados, com altura minima de toque. */
  .draft__actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .draft__actions .btn {
    width: 100%;
    min-height: 42px;
    justify-content: center;
  }

  /* Contador de caracteres nao deve empurrar o layout. */
  .draft__label { flex-wrap: wrap; }
  .draft textarea { min-height: 108px; font-size: 16px; }

  .nf-toast {
    bottom: 12px;
    left: 12px;
    right: 12px;
    transform: translateY(20px);
    justify-content: center;
  }

  .nf-toast.is-visible { transform: none; }

  .nf-overlay__box { padding: 18px 22px; }
}

@media (max-width: 420px) {
  .topbar__brand { font-size: 0.7rem; letter-spacing: 0.08em; }
  .topbar__nav a { padding: 5px 7px; font-size: 0.57rem; }
  .stat { font-size: 0.58rem; }
  .stat strong { font-size: 0.85rem; }
  .topbar__stats { gap: 14px; }
}

/* -------------------------------------------------- formulario de IA */
.ai-form {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.ai-form .field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.ai-form .field > span {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.ai-form .field > span small {
  letter-spacing: 0;
  text-transform: none;
  font-size: 0.7rem;
  opacity: 0.7;
}

.ai-form input[type="text"],
.ai-form input[type="password"],
.ai-form select {
  width: 100%;
  min-width: 0;
}

/* Modelo e URL base lado a lado quando ha espaco. */
.ai-form__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.ai-form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 6px;
  cursor: pointer;
}

@media (max-width: 640px) {
  .ai-form__row { grid-template-columns: 1fr; }
}

/* Seletor visual de provedor de IA. */
.ai-pick {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  margin: 6px 0 4px;
}

.ai-pick label {
  display: block;
  cursor: pointer;
}

.ai-pick input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.ai-pick__box {
  display: grid;
  gap: 3px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
  height: 100%;
}

.ai-pick__box strong {
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--graphite);
}

.ai-pick__box em {
  font-style: normal;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.ai-pick input:checked + .ai-pick__box {
  border-color: var(--gold);
  background: #fdfaf4;
  box-shadow: 0 0 0 3px rgba(184, 154, 99, 0.14);
}

.ai-pick input:focus-visible + .ai-pick__box {
  outline: 2px solid var(--gold-dark);
  outline-offset: 2px;
}

/* Selo de custo: verde para gratis, neutro para pago. */
.ai-pick__box em.is-free { color: var(--ok); }
