/* Agência de Conversão | Performance
 * Camada de shell do aplicativo instalado. 1.8.0
 * Carregada depois do CSS de cada página, por isso ajusta apenas o que
 * pertence à experiência de aplicativo: áreas seguras, instalação, estado de
 * conexão, atualização, paleta de comandos, período e gráficos.
 */

:root {
  --ac-safe-top: env(safe-area-inset-top, 0px);
  --ac-safe-bottom: env(safe-area-inset-bottom, 0px);
  --ac-safe-left: env(safe-area-inset-left, 0px);
  --ac-safe-right: env(safe-area-inset-right, 0px);
  --ac-titlebar: 0px;
}

/* ---------------------------------------------------------------
   1. Áreas seguras: iPhone com recorte, Android com barra de gestos
   --------------------------------------------------------------- */
body.is-standalone .topbar {
  padding-top: var(--ac-safe-top);
  height: calc(72px + var(--ac-safe-top));
}
@media (max-width: 760px) {
  body.is-standalone .topbar { height: calc(62px + var(--ac-safe-top)); }
  body.is-standalone .content { padding-bottom: calc(96px + var(--ac-safe-bottom)); }
  body.is-standalone .mobile-nav { bottom: calc(8px + var(--ac-safe-bottom)); }
}
body.is-standalone .sidebar { padding-top: calc(20px + var(--ac-safe-top)); }
body.is-standalone { padding-left: var(--ac-safe-left); padding-right: var(--ac-safe-right); }

/* Sobreposição dos controles de janela no desktop instalado.
   Sem isso, o cabeçalho fica embaixo dos botões fechar e minimizar. */
body.is-wco { --ac-titlebar: env(titlebar-area-height, 34px); }
body.is-wco .topbar {
  padding-top: var(--ac-titlebar);
  height: calc(72px + var(--ac-titlebar));
  -webkit-app-region: drag;
}
body.is-wco .topbar button,
body.is-wco .topbar .pill,
body.is-wco .topbar select,
body.is-wco .topbar input { -webkit-app-region: no-drag; }
body.is-wco .sidebar { padding-top: calc(20px + var(--ac-titlebar)); }

/* ---------------------------------------------------------------
   2. Barra de estado do aplicativo (conexão, atualização, instalação)
   --------------------------------------------------------------- */
.ac-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%) translateY(-140%);
  top: calc(10px + var(--ac-safe-top) + var(--ac-titlebar));
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(640px, calc(100vw - 24px));
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid #343434;
  background: rgba(22, 22, 22, .97);
  backdrop-filter: blur(18px);
  box-shadow: 0 22px 60px rgba(0, 0, 0, .55);
  color: #f0f0f0;
  font-size: 12.5px;
  line-height: 1.4;
  transition: transform .28s cubic-bezier(.2, .8, .2, 1), opacity .2s;
  opacity: 0;
}
.ac-bar.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.ac-bar strong { display: block; font-size: 12.5px; margin-bottom: 2px; }
.ac-bar span { color: #9c9c9c; font-size: 11px; }
.ac-bar .ac-bar-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: #f2b84b; }
.ac-bar.offline .ac-bar-dot { background: #ff6b75; }
.ac-bar.update .ac-bar-dot { background: #63a6ff; }
.ac-bar.ok .ac-bar-dot { background: #42bd75; }
.ac-bar-actions { margin-left: auto; display: flex; gap: 7px; flex: 0 0 auto; }
.ac-btn {
  border: 1px solid #3a3a3a; background: #202020; color: #e8e8e8;
  border-radius: 10px; padding: 7px 11px; font-size: 11.5px; font-weight: 700; cursor: pointer;
}
.ac-btn:hover { background: #2a2a2a; }
.ac-btn.solid { border: 0; background: linear-gradient(135deg, #e22a36, #b3131d); color: #fff; }

body.is-offline .ac-offline-lock { opacity: .45; pointer-events: none; }

/* ---------------------------------------------------------------
   3. Convite de instalação
   --------------------------------------------------------------- */
.ac-install-cta {
  display: none; align-items: center; gap: 8px;
  border: 1px solid rgba(226, 42, 54, .32);
  background: linear-gradient(135deg, rgba(226, 42, 54, .18), rgba(179, 19, 29, .06));
  color: #fff; border-radius: 11px; padding: 9px 12px;
  font-size: 11.5px; font-weight: 800; cursor: pointer; white-space: nowrap;
}
.ac-install-cta.available { display: inline-flex; }
.ac-install-cta:before { content: "⤓"; font-size: 13px; }

.ac-sheet-backdrop {
  position: fixed; inset: 0; z-index: 240; display: none;
  background: rgba(0, 0, 0, .74); backdrop-filter: blur(8px);
  align-items: center; justify-content: center; padding: 18px;
}
.ac-sheet-backdrop.show { display: flex; }
.ac-sheet {
  width: min(520px, 100%);
  background: linear-gradient(180deg, #191919, #101010);
  border: 1px solid #343434; border-radius: 22px;
  box-shadow: 0 40px 130px rgba(0, 0, 0, .7);
  padding: 24px;
  max-height: min(86vh, 760px); overflow: auto;
  padding-bottom: calc(24px + var(--ac-safe-bottom));
}
.ac-sheet h3 { margin: 0 0 6px; font-size: 17px; letter-spacing: -.02em; color: #fff; }
.ac-sheet .ac-sheet-sub { color: #9a9a9a; font-size: 12px; line-height: 1.55; margin-bottom: 18px; }
.ac-sheet-logo { width: 190px; max-width: 60%; height: auto; display: block; margin-bottom: 16px; }
.ac-steps { display: grid; gap: 10px; margin: 0 0 18px; padding: 0; list-style: none; }
.ac-steps li {
  display: grid; grid-template-columns: 26px 1fr; gap: 11px; align-items: start;
  padding: 12px; border: 1px solid #2b2b2b; border-radius: 13px; background: #131313;
  font-size: 12px; color: #ccc; line-height: 1.5;
}
.ac-steps b {
  width: 26px; height: 26px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(145deg, #ef3642, #860912); color: #fff; font-size: 11px;
}
.ac-steps em { font-style: normal; color: #fff; font-weight: 700; }
.ac-sheet-foot { display: flex; justify-content: flex-end; gap: 8px; }
.ac-tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.ac-tabs button {
  border: 1px solid #2e2e2e; background: #141414; color: #8d8d8d;
  border-radius: 9px; padding: 7px 11px; font-size: 11px; font-weight: 700; cursor: pointer;
}
.ac-tabs button.active { background: #262626; color: #fff; border-color: #3d3d3d; }
.ac-platform { display: none; }
.ac-platform.active { display: block; }

/* ---------------------------------------------------------------
   4. Paleta de comandos
   --------------------------------------------------------------- */
.ac-palette-backdrop {
  position: fixed; inset: 0; z-index: 250; display: none;
  background: rgba(0, 0, 0, .68); backdrop-filter: blur(10px);
  align-items: flex-start; justify-content: center;
  padding: calc(12vh + var(--ac-safe-top)) 16px 16px;
}
.ac-palette-backdrop.show { display: flex; }
.ac-palette {
  width: min(620px, 100%);
  background: linear-gradient(180deg, #1b1b1b, #111);
  border: 1px solid #3a3a3a; border-radius: 18px;
  box-shadow: 0 40px 120px rgba(0, 0, 0, .7); overflow: hidden;
}
.ac-palette input {
  width: 100%; border: 0; outline: 0; background: transparent; color: #fff;
  padding: 17px 18px; font-size: 15px; border-bottom: 1px solid #2b2b2b;
}
.ac-palette input::placeholder { color: #6b6b6b; }
.ac-palette-list { max-height: min(52vh, 420px); overflow: auto; padding: 7px; }
.ac-palette-item {
  display: grid; grid-template-columns: 28px 1fr auto; gap: 11px; align-items: center;
  padding: 10px 11px; border-radius: 11px; cursor: pointer; color: #d2d2d2; font-size: 12.5px;
}
.ac-palette-item:hover, .ac-palette-item.active { background: #262626; color: #fff; }
.ac-palette-item i { font-style: normal; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: #202020; font-size: 13px; }
.ac-palette-item small { display: block; color: #7f7f7f; font-size: 10px; margin-top: 2px; }
.ac-palette-item kbd {
  font: inherit; font-size: 9.5px; color: #8b8b8b;
  border: 1px solid #333; border-radius: 6px; padding: 3px 6px; background: #161616;
}
.ac-palette-empty { padding: 26px 18px; text-align: center; color: #7d7d7d; font-size: 12px; }
.ac-palette-foot {
  display: flex; gap: 14px; padding: 9px 14px; border-top: 1px solid #262626;
  color: #6f6f6f; font-size: 10px; flex-wrap: wrap;
}

/* ---------------------------------------------------------------
   5. Seletor de período
   --------------------------------------------------------------- */
/* O contêiner rola na horizontal e a régua mantém a largura do conteúdo.
   Sem isso a régua de períodos estoura a largura da tela no celular e empurra
   o layout inteiro, derrubando a barra de navegação inferior para fora da
   área visível. */
[data-ac-period] { max-width: 100%; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
[data-ac-period]::-webkit-scrollbar { display: none; }
.ac-period {
  display: inline-flex; align-items: center; gap: 6px; min-width: max-content;
  border: 1px solid #2b2b2b; background: #121212; border-radius: 11px; padding: 4px;
}
.ac-period button {
  border: 0; background: transparent; color: #8f8f8f;
  border-radius: 8px; padding: 6px 10px; font-size: 11px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.ac-period button:hover { color: #fff; }
.ac-period button.active { background: #262626; color: #fff; }
.ac-period-custom { display: flex; gap: 6px; align-items: center; }
.ac-period-custom input {
  border: 1px solid #2b2b2b; background: #101010; color: #ddd;
  border-radius: 9px; padding: 6px 8px; font-size: 11px;
}
.ac-range-label { color: #7f7f7f; font-size: 10.5px; }

/* ---------------------------------------------------------------
   6. Gráficos
   --------------------------------------------------------------- */
.ac-chart { width: 100%; display: block; overflow: visible; }
.ac-chart-wrap { position: relative; }
.ac-chart-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; }
.ac-chart-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 10px; color: #8f8f8f; }
.ac-chart-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.ac-chart-tip {
  position: absolute; pointer-events: none; z-index: 4;
  background: #1d1d1d; border: 1px solid #3a3a3a; border-radius: 10px;
  padding: 9px 11px; font-size: 10.5px; color: #e6e6e6; white-space: nowrap;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .5); opacity: 0; transition: opacity .12s;
}
.ac-chart-tip.show { opacity: 1; }
.ac-chart-tip b { display: block; color: #fff; margin-bottom: 4px; font-size: 11px; }
.ac-chart-tip u { text-decoration: none; color: #9a9a9a; }

/* ---------------------------------------------------------------
   7. Variação em relação ao período anterior
   --------------------------------------------------------------- */
.ac-delta { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700; }
.ac-delta.pos { color: #63d894; }
.ac-delta.neg { color: #ff7e87; }
.ac-delta.flat { color: #949494; }
.ac-delta em { font-style: normal; color: #7d7d7d; font-weight: 500; }

/* ---------------------------------------------------------------
   8. Carregamento
   --------------------------------------------------------------- */
.ac-skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg, #191919 25%, #232323 37%, #191919 63%);
  background-size: 400% 100%;
  animation: ac-shimmer 1.3s ease infinite;
  color: transparent !important;
}
@keyframes ac-shimmer { 0% { background-position: 100% 50% } 100% { background-position: 0 50% } }
.ac-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0;
  background: linear-gradient(90deg, #e22a36, #ff7a83);
  z-index: 300; transition: width .25s ease, opacity .3s;
}

/* ---------------------------------------------------------------
   9. Acessibilidade e acabamento
   --------------------------------------------------------------- */
:focus-visible { outline: 2px solid #e22a36; outline-offset: 2px; border-radius: 6px; }
* { -webkit-tap-highlight-color: rgba(226, 42, 54, .18); }
input, select, textarea { font-size: max(16px, 1em); }
@media (min-width: 761px) { input, select, textarea { font-size: inherit; } }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2b2b2b; border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #3d3d3d; background-clip: content-box; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.ac-kbd-hint {
  display: none; align-items: center; gap: 5px;
  border: 1px solid #2b2b2b; background: #121212; color: #8a8a8a;
  border-radius: 9px; padding: 7px 10px; font-size: 10.5px; cursor: pointer;
}
@media (min-width: 1000px) { .ac-kbd-hint { display: inline-flex; } }
.ac-kbd-hint kbd { border: 1px solid #333; border-radius: 5px; padding: 2px 5px; background: #1a1a1a; font: inherit; font-size: 9.5px; }

@media print {
  .sidebar, .topbar, .mobile-nav, .ac-bar, .ac-install-cta, .ac-kbd-hint, .ac-period { display: none !important; }
  .main { margin-left: 0 !important; }
  .card { break-inside: avoid; box-shadow: none; }
}

/* ---------------------------------------------------------------
   Botão INSPIRE-SE e player do Mantra da Conversão
   --------------------------------------------------------------- */
.ac-inspire-cta {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid rgba(226, 42, 54, .35);
  background: linear-gradient(135deg, rgba(226, 42, 54, .16), rgba(179, 19, 29, .05));
  color: #fff; border-radius: 11px; padding: 8px 12px;
  font-size: 11.5px; font-weight: 800; cursor: pointer; white-space: nowrap;
  transition: border-color .2s, background .2s;
}
.ac-inspire-cta:hover { border-color: rgba(226, 42, 54, .6); background: linear-gradient(135deg, rgba(226, 42, 54, .26), rgba(179, 19, 29, .1)); }
.ac-inspire-cta .ac-inspire-icon { display: grid; place-items: center; color: #ff6b73; }
.ac-inspire-cta.playing { border-color: #e22a36; }
.ac-inspire-cta.playing .ac-inspire-icon { color: #fff; animation: ac-inspire-pulse 1.1s ease-in-out infinite; }
@keyframes ac-inspire-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .55; transform: scale(.86); } }

.ac-mantra-backdrop {
  position: fixed; inset: 0; z-index: 260; display: none;
  background: rgba(0, 0, 0, .76); backdrop-filter: blur(12px);
  align-items: center; justify-content: center; padding: 18px;
}
.ac-mantra-backdrop.show { display: flex; }
.ac-mantra {
  position: relative; width: min(440px, 100%);
  background: radial-gradient(120% 90% at 50% 0%, rgba(179, 19, 29, .22), transparent 55%), linear-gradient(180deg, #171717, #0d0d0d);
  border: 1px solid #343434; border-radius: 24px;
  box-shadow: 0 44px 130px rgba(0, 0, 0, .7);
  padding: 30px 26px 26px; text-align: center;
  padding-bottom: calc(26px + var(--ac-safe-bottom));
}
.ac-mantra-close {
  position: absolute; top: 14px; right: 16px;
  width: 32px; height: 32px; border-radius: 9px;
  border: 1px solid #343434; background: #1c1c1c; color: #cfcfcf;
  font-size: 20px; line-height: 1; cursor: pointer;
}
.ac-mantra-close:hover { background: #262626; }
.ac-mantra-seal { width: 62px; height: auto; opacity: .85; margin: 4px auto 14px; display: block; }
.ac-mantra-eyebrow { color: #e2555e; font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.ac-mantra h3 { margin: 8px 0 4px; font-size: 22px; letter-spacing: -.02em; color: #fff; }
.ac-mantra-sub { color: #9a9a9a; font-size: 12px; line-height: 1.5; margin: 0 0 22px; }

.ac-mantra-art { display: grid; place-items: center; height: 78px; margin-bottom: 18px; }
.ac-mantra-bars { display: flex; align-items: flex-end; gap: 5px; height: 60px; }
.ac-mantra-bars i {
  width: 5px; height: 14px; border-radius: 3px;
  background: linear-gradient(180deg, #ef4b55, #8f0f18);
  opacity: .5;
}
.ac-mantra-art.playing .ac-mantra-bars i { animation: ac-wave 1s ease-in-out infinite; opacity: 1; }
.ac-mantra-art.playing .ac-mantra-bars i:nth-child(1) { animation-delay: 0s; }
.ac-mantra-art.playing .ac-mantra-bars i:nth-child(2) { animation-delay: .12s; }
.ac-mantra-art.playing .ac-mantra-bars i:nth-child(3) { animation-delay: .24s; }
.ac-mantra-art.playing .ac-mantra-bars i:nth-child(4) { animation-delay: .1s; }
.ac-mantra-art.playing .ac-mantra-bars i:nth-child(5) { animation-delay: .32s; }
.ac-mantra-art.playing .ac-mantra-bars i:nth-child(6) { animation-delay: .18s; }
.ac-mantra-art.playing .ac-mantra-bars i:nth-child(7) { animation-delay: .28s; }
.ac-mantra-art.playing .ac-mantra-bars i:nth-child(8) { animation-delay: .06s; }
.ac-mantra-art.playing .ac-mantra-bars i:nth-child(9) { animation-delay: .2s; }
@keyframes ac-wave { 0%, 100% { height: 14px; } 50% { height: 54px; } }

.ac-mantra-controls { display: flex; align-items: center; gap: 14px; }
.ac-mantra-play {
  flex: 0 0 auto; width: 52px; height: 52px; border-radius: 50%;
  border: 0; background: linear-gradient(135deg, #ef3642, #a5121b); color: #fff;
  display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 12px 30px rgba(179, 19, 29, .4);
}
.ac-mantra-play:hover { filter: brightness(1.08); }
.ac-mantra-track { flex: 1; }
.ac-mantra-time { display: flex; justify-content: space-between; color: #8f8f8f; font-size: 10.5px; margin-bottom: 5px; }
.ac-mantra-seek {
  width: 100%; height: 5px; border-radius: 99px; -webkit-appearance: none; appearance: none;
  background: #2b2b2b; cursor: pointer; outline: none;
}
.ac-mantra-seek::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 15px; height: 15px; border-radius: 50%; background: #ef3642; border: 2px solid #fff; cursor: pointer;
}
.ac-mantra-seek::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%; background: #ef3642; border: 2px solid #fff; cursor: pointer;
}
