/* Design system do painel.
 *
 * Herda a identidade dos guias que a BOB já recebeu — terracota, creme,
 * Fraunces + DM Sans — pra que o painel seja reconhecidamente a mesma coisa
 * que o material que eles leram antes de entrar aqui.
 *
 * Nada de componente nativo cru (MANUAL-DE-INTERFACE): botão, cartão, chip de
 * estado, toast e menu são todos desenhados aqui, com os seis estados.
 */

:root {
  --terra: #d1784f;
  --terra-deep: #b8633d;
  --terra-soft: #fbe9df;
  --cream: #f6efe6;
  --white: #fffdf9;
  --ink: #2b211b;
  --muted: #7a6a5e;
  --line: #e9dfd2;

  --ok: #5f8a5a;
  --ok-soft: #eef3ea;
  --warn: #b07d2a;
  --warn-soft: #fbf2e0;
  --danger: #b1493a;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 26px;

  --shadow-1: 0 1px 0 rgba(43, 33, 27, .05);
  --shadow-2: 0 6px 20px rgba(43, 33, 27, .08);
  --shadow-3: 0 16px 40px rgba(184, 99, 61, .18);

  /* Spring, não linear: é o que faz o toque parecer físico. */
  --ease: cubic-bezier(.2, .8, .3, 1);
}

* { box-sizing: border-box; }

html {
  height: 100%;
  overscroll-behavior: none;       /* APPS-GUIDE 8: sem rubber-band de página */
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--cream);
  color: var(--ink);
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  touch-action: pan-y;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 {
  font-family: Fraunces, Georgia, serif;
  font-weight: 600;
  letter-spacing: -.01em;
  margin: 0;
}

/* Foco próprio — nunca o anel azul do browser. */
:focus-visible {
  outline: 2px solid var(--terra);
  outline-offset: 3px;
  border-radius: 6px;
}
:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--terra-soft); color: var(--terra-deep); }

/* Scrollbar própria (nada nativo cru). */
* { scrollbar-width: thin; scrollbar-color: #d9cbb9 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: #d9cbb9; border-radius: 99px;
  border: 3px solid var(--cream); background-clip: content-box;
}
*::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* ---------------------------------------------------------------- estrutura */

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px calc(72px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--cream) 88%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s var(--ease);
  padding-top: env(safe-area-inset-top);
}
.topbar.scrolled { border-bottom-color: var(--line); }

.topbar-in {
  max-width: 880px; margin: 0 auto;
  padding: 12px 20px;
  display: flex; align-items: center; gap: 12px;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { width: 34px; height: 34px; border-radius: 10px; flex: none; }
.brand .bt { min-width: 0; }
.brand .name {
  font-family: Fraunces, Georgia, serif; font-weight: 600;
  font-size: 17px; line-height: 1.1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand .co {
  font-size: 12px; color: var(--muted); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.spacer { flex: 1; }

/* ------------------------------------------------------------------ botões */

.btn {
  -webkit-appearance: none; appearance: none;
  font: inherit; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--r-md);
  padding: 12px 20px; min-height: 46px;
  cursor: pointer; text-decoration: none;
  transition: transform .18s var(--ease), background .18s var(--ease),
              box-shadow .18s var(--ease), border-color .18s var(--ease),
              color .18s var(--ease);
  user-select: none; position: relative;
}
.btn:active:not(:disabled) { transform: scale(.96); }
.btn:disabled { cursor: not-allowed; opacity: .55; }

.btn-primary {
  background: linear-gradient(180deg, #da8259, var(--terra));
  color: #fff; box-shadow: var(--shadow-2);
}
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover:not(:disabled) {
    background: linear-gradient(180deg, var(--terra), var(--terra-deep));
    box-shadow: var(--shadow-3);
  }
}

.btn-ghost {
  background: var(--white); color: var(--ink); border-color: var(--line);
  box-shadow: var(--shadow-1);
}
@media (hover: hover) and (pointer: fine) {
  .btn-ghost:hover:not(:disabled) { border-color: #dbcbb8; background: #fff; }
}

.btn-quiet {
  background: transparent; color: var(--muted);
  padding: 8px 12px; min-height: 38px; font-weight: 500;
}
@media (hover: hover) and (pointer: fine) {
  .btn-quiet:hover:not(:disabled) { color: var(--ink); background: rgba(43,33,27,.05); }
}

.btn-lg { padding: 15px 26px; min-height: 54px; font-size: 16.5px; border-radius: var(--r-md); }
.btn-block { width: 100%; }

/* Spinner INLINE dentro do botão — o botão não some enquanto trabalha. */
.spin {
  width: 16px; height: 16px; flex: none;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: gira .7s linear infinite;
}
@keyframes gira { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------- chip de estado */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; line-height: 1;
  padding: 6px 10px; border-radius: 99px; white-space: nowrap;
}
/* Um rótulo longo ("não deu pra conferir") não pode espremer a descrição do
 * cartão: abaixo de certa largura ele desce pra própria linha, como no mobile. */
@media (min-width: 561px) and (max-width: 900px) {
  .grid-2 .src { grid-template-columns: 42px 1fr; }
  .grid-2 .src > .chip { grid-column: 2; justify-self: start; margin-top: 2px; }
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }

.chip-ok      { background: var(--ok-soft);   color: var(--ok); }
.chip-ok .dot { background: var(--ok); }
.chip-off     { background: #f1ece5;          color: var(--muted); }
.chip-off .dot{ background: #bfb1a2; }
.chip-unk     { background: var(--warn-soft); color: var(--warn); }
.chip-unk .dot{ background: var(--warn); }

/* Estado "conferindo": o ponto pulsa, então dá pra ver que está vivo. */
.chip-load     { background: #f1ece5; color: var(--muted); }
.chip-load .dot{ background: #bfb1a2; animation: pulsa 1.1s ease-in-out infinite; }
@keyframes pulsa { 0%,100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }

/* ----------------------------------------------------------------- cartões */

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: 18px 20px;
}

.grid { display: grid; gap: 12px; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* `stretch` no grid + o cartão como coluna: os cartões da mesma linha ficam da
 * mesma altura e o estado fica sempre no topo, alinhado entre colunas. */
.grid { align-items: stretch; }

.src {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 14px; align-items: start;
  align-content: start;
}
/* Em tela estreita o chip sai de junto do título e desce pra própria linha:
 * disputando largura com o texto ele espremia a descrição em 3 palavras por
 * linha e quebrava nomes curtos ("Google Analytics") no meio. */
@media (max-width: 560px) {
  .src { grid-template-columns: 42px 1fr; }
  .src > .chip { grid-column: 2; justify-self: start; margin-top: 2px; }
}

.src .ico {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center; flex: none;
  background: var(--cream); border: 1px solid var(--line);
}
.src .ico svg { width: 22px; height: 22px; display: block; }
.src h3 { font-size: 16.5px; line-height: 1.25; }
.src .desc { color: var(--muted); font-size: 14px; margin: 3px 0 0; }
.src .sub { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.src .sub a { color: var(--terra-deep); font-weight: 600; text-decoration: none; }
@media (hover: hover) and (pointer: fine) { .src .sub a:hover { text-decoration: underline; } }

/* O cartão da fonte já lida muda de peso: é o cartão que importa. A faixa
 * verde na borda faz a diferença sobreviver ao relance e ao daltonismo —
 * não é só a cor do texto que muda. */
.src-on {
  border-color: #cfe0cb;
  background: linear-gradient(180deg, #fbfdfa, var(--white));
  box-shadow: inset 3px 0 0 var(--ok), var(--shadow-1);
}
.src-on .ico { background: var(--ok-soft); border-color: #cfe0cb; color: var(--ok); }

/* Skeleton — placeholder do resultado enquanto carrega, não tela branca. */
.sk {
  background: linear-gradient(90deg, #efe7dc 25%, #f7f1e8 37%, #efe7dc 63%);
  background-size: 400% 100%;
  animation: brilha 1.4s ease infinite;
  border-radius: 6px; color: transparent;
}
@keyframes brilha { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ------------------------------------------------------------------ seções */

.sec { margin: 40px 0 0; }
.sec-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; }

/* No mobile o título fica sozinho na linha e o par carimbo+botão desce junto,
 * alinhado à direita — em vez do botão flutuando centralizado sob o título. */
@media (max-width: 560px) {
  .sec-head { align-items: center; row-gap: 8px; }
  .sec-head h2 { flex: 1 0 100%; }
  .sec-head .spacer { display: none; }
  .sec-head .stamp { flex: 1; }
}
.sec h2 { font-size: 24px; }
.sec .lead { color: var(--muted); font-size: 15px; margin: 6px 0 0; max-width: 58ch; }
.sec .stamp { color: var(--muted); font-size: 13px; }

.band {
  background: linear-gradient(135deg, var(--terra), var(--terra-deep));
  color: #fff; border-radius: var(--r-xl);
  padding: 26px 28px; box-shadow: var(--shadow-3);
}
.band h2 { color: #fff; font-size: 23px; }
.band p { margin: 8px 0 18px; opacity: .95; max-width: 52ch; }
.band .btn-ghost { background: #fff; border-color: transparent; color: var(--terra-deep); }

.steps { counter-reset: s; display: grid; gap: 10px; margin: 14px 0 0; }
.steps li {
  position: relative; list-style: none;
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 13px 16px 13px 46px;
  font-size: 15px;
}
.steps li::before {
  counter-increment: s; content: counter(s);
  position: absolute; left: 14px; top: 13px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--terra); color: #fff;
  font-weight: 600; font-size: 13px; display: grid; place-items: center;
}
.cmd {
  background: var(--terra-soft); color: var(--terra-deep);
  padding: 1px 7px; border-radius: 5px; font-weight: 600;
  font-size: .95em; white-space: nowrap;
}

/* ------------------------------------------------------- exemplos do que pedir */

.asks { display: grid; gap: 8px; margin: 0; padding: 0; }
.ask {
  list-style: none;
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 14px;
  display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center;
  transition: border-color .18s var(--ease), transform .18s var(--ease);
}
@media (hover: hover) and (pointer: fine) { .ask:hover { border-color: #dbcbb8; } }
.ask .txt { font-size: 15px; }
.ask .at { color: var(--terra-deep); font-weight: 600; }
.ask .copy {
  opacity: 0; transition: opacity .18s var(--ease);
  font-size: 13px; padding: 6px 10px; min-height: 32px;
}
/* Em toque não há hover: o botão fica sempre visível. */
@media (hover: none), (pointer: coarse) { .ask .copy { opacity: 1; } }
.ask:hover .copy, .ask:focus-within .copy { opacity: 1; }
.ask .copy.done { color: var(--ok); opacity: 1; }

/* ------------------------------------------------------------------- toast */

.toasts {
  position: fixed; z-index: 90;
  left: 50%; transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom));
  display: grid; gap: 8px; width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  background: var(--ink); color: #fff;
  border-radius: var(--r-md); padding: 12px 16px;
  font-size: 14.5px; box-shadow: var(--shadow-3);
  display: flex; align-items: center; gap: 10px;
  animation: sobe .26s var(--ease);
  pointer-events: auto;
}
.toast-err { background: var(--danger); }
.toast .act {
  margin-left: auto; color: #fff; background: rgba(255,255,255,.18);
  border: none; border-radius: 8px; padding: 8px 12px;
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  /* Sem isto o rótulo da ação quebra em três linhas e o toast vira um bloco. */
  white-space: nowrap; flex: none;
  transition: background .18s var(--ease), transform .18s var(--ease);
}
.toast .act:active { transform: scale(.95); }
@media (hover: hover) and (pointer: fine) {
  .toast .act:hover { background: rgba(255,255,255,.3); }
}
@keyframes sobe { from { opacity: 0; transform: translateY(10px); } }

/* ------------------------------------------------------------------- login */

.signin {
  min-height: 100dvh;
  display: grid; place-items: center;
  padding: 24px calc(20px + env(safe-area-inset-left)) calc(24px + env(safe-area-inset-bottom));
}
.signin .box { width: min(420px, 100%); text-align: center; }
.signin .mark {
  width: 84px; height: 84px; border-radius: 24px; margin: 0 auto 22px;
  box-shadow: var(--shadow-3); display: block;
}
.signin h1 { font-size: clamp(28px, 7vw, 38px); }
.signin p { color: var(--muted); margin: 10px 0 26px; }

/* Botão de Google: desenhado por nós, não o widget cru do provedor. */
.g-ico { width: 19px; height: 19px; flex: none; }

/* ------------------------------------------------------------------ vazio */

.empty {
  text-align: center; padding: 34px 20px;
  color: var(--muted); font-size: 15px;
}
.empty .big { font-size: 17px; color: var(--ink); font-weight: 600; margin: 0 0 6px; }

.lang {
  display: inline-flex; background: var(--white);
  border: 1px solid var(--line); border-radius: 99px; padding: 3px;
}
.lang button {
  -webkit-appearance: none; appearance: none; border: none; background: transparent;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted);
  padding: 5px 11px; border-radius: 99px; cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.lang button[aria-pressed="true"] { background: var(--terra-soft); color: var(--terra-deep); }
@media (hover: hover) and (pointer: fine) {
  .lang button:not([aria-pressed="true"]):hover { color: var(--ink); }
}

.hide { display: none !important; }

/* Quem está logado no topo — o "sair" nunca fica solto, sem dono. */
.btn.who { gap: 8px; padding: 6px 12px 6px 6px; border-radius: 99px; }
.btn.who img, .btn.who .ini {
  width: 26px; height: 26px; border-radius: 50%; flex: none; display: block;
}
.btn.who .ini {
  background: var(--terra-soft); color: var(--terra-deep);
  display: grid; place-items: center; font-size: 12.5px; font-weight: 600;
}
@media (max-width: 560px) { .btn.who .lbl { display: none; } }
