/* =========================================================
   Painel da conta
   Tokens do site de divulgação: paleta monocromática, bordas de 1px, raios e
   tipografia. Sem fonte externa (CSP font-src 'self'): Inter se instalada, senão
   a do sistema. Os logos são brancos: no tema claro, --logo-filter inverte.
   Layout: barra lateral (computador) | topo + abas embaixo (celular, até 860px).
   ========================================================= */

:root {
  --bg: #0e0e0f;
  --bg-2: #141415;
  --surface: #18181a;
  --surface-2: #202022;
  --surface-3: #2a2a2d;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --text: #f2f2f3;
  --text-2: #d6d6d8;
  --muted: #8d8d92;
  --faint: #55555a;
  --glow: 255, 255, 255;
  --on-rgb: 11, 11, 12;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 24px 60px -36px rgba(0, 0, 0, 0.9);
  --danger: #ff8a80;
  --danger-line: rgba(255, 138, 128, 0.3);
  --danger-fill: rgba(255, 138, 128, 0.08);
  --ok: #8fd19e;
  --ok-fill: rgba(143, 209, 158, 0.1);
  --logo-filter: none;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sans: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  --side-w: 248px;
  --tab-h: 64px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f5f3; --bg-2: #ededea; --surface: #ffffff; --surface-2: #f3f3f0; --surface-3: #e8e8e4;
    --line: rgba(0, 0, 0, 0.07); --line-2: rgba(0, 0, 0, 0.13);
    --text: #121213; --text-2: #2e2e32; --muted: #66666c; --faint: #a3a3a8;
    --glow: 0, 0, 0; --on-rgb: 250, 250, 250;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 18px 48px -32px rgba(0, 0, 0, 0.22);
    --danger: #b42318; --danger-line: rgba(180, 35, 24, 0.28); --danger-fill: rgba(180, 35, 24, 0.06);
    --ok: #1f7a3a; --ok-fill: rgba(31, 122, 58, 0.08);
    --logo-filter: invert(1);
    color-scheme: light;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font: 15px/1.55 var(--sans);
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 85% -12%, rgba(var(--glow), 0.05), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; letter-spacing: -0.025em; line-height: 1.15; font-weight: 600; }
h1 { font-size: 28px; }
h2 { font-size: 17px; letter-spacing: -0.015em; }
p { margin: 0; }
a { color: inherit; }
code { font-family: var(--mono); font-size: 12.5px; }
img { display: block; }
::selection { background: var(--text); color: rgb(var(--on-rgb)); }
:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; border-radius: 8px; }

.logo { filter: var(--logo-filter); }
.wordmark { height: 30px; width: auto; }
.ico { flex: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: 12px; top: -48px; z-index: 50;
  padding: 10px 14px; border-radius: 10px; background: var(--text); color: rgb(var(--on-rgb));
  text-decoration: none; font-weight: 600;
}
.skip:focus { top: 12px; }

/* ---------- abertura (antes de saber se há login) ---------- */
.boot { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; outline: none; }
.boot-mark { width: 52px; height: 52px; opacity: 0.9; animation: breathe 1.6s var(--ease) infinite; }
@keyframes breathe { 50% { transform: scale(0.92); opacity: 0.45; } }

/* ---------- páginas centradas (login, erro, conta excluída) ---------- */
.center-page {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px;
  padding: 32px 16px; outline: none;
}
.center-brand .wordmark { height: 40px; }

/* ---------- moldura ---------- */
.layout { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }

.side {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: 28px;
  padding: 24px 14px 16px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-2) 70%, transparent);
}
.side-brand { display: inline-flex; padding: 4px 10px; border-radius: 10px; align-self: flex-start; }
.side-nav { display: grid; gap: 2px; }
.side-link {
  position: relative; display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--muted); text-decoration: none; font-weight: 500;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.side-link:hover { color: var(--text); background: rgba(var(--glow), 0.04); }
.side-link[aria-current="page"] { color: var(--text); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.side-link[aria-current="page"]::before {
  content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--text);
}
.side-foot { margin-top: auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.side-site {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  color: var(--muted); font-size: 13px; text-decoration: none; border-radius: 8px;
}
.side-site:hover { color: var(--text); }
.me {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.me-email { flex: 1; min-width: 0; font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 600; font-size: 13px;
  background: var(--surface-3); color: var(--text);
}

.topbar, .tabbar { display: none; }

.content {
  width: 100%; max-width: 900px; margin: 0 auto;
  padding: 44px clamp(16px, 4vw, 48px) 80px;
  outline: none;
}

/* ---------- conteúdo ---------- */
.view { display: grid; gap: 16px; animation: enter 0.35s var(--ease) both; }
.view-body { display: grid; gap: 16px; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } }
.page-head { margin-bottom: 8px; display: grid; gap: 6px; }
.lead { color: var(--muted); font-size: 15.5px; }
.stack-sm { display: grid; gap: 10px; justify-items: start; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 22px; box-shadow: var(--shadow);
  display: grid; gap: 12px; align-content: start;
}
.card.narrow { width: 100%; max-width: 420px; }
.card-head { display: flex; align-items: center; gap: 10px; }
.count {
  min-width: 22px; padding: 1px 7px; border-radius: 999px; text-align: center;
  font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2);
}
.row-card { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; }
.row-card > div { display: grid; gap: 4px; }

/* cartão principal (status de acesso, download) */
.hero {
  padding: 26px;
  background:
    radial-gradient(600px 220px at 100% 0%, rgba(var(--glow), 0.05), transparent 70%),
    var(--surface);
}
.hero h2 { font-size: 22px; letter-spacing: -0.025em; }
.hero > .muted { max-width: 58ch; }
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.hero .actions { margin-top: 6px; }

.icon-box {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line);
}
.icon-box.ok { color: var(--ok); background: var(--ok-fill); border-color: transparent; }

.pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--line);
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.pill.ok { color: var(--ok); background: var(--ok-fill); border-color: transparent; }
.pill.ok .dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.pill.sm { padding: 1px 8px; font-size: 11.5px; margin-left: 8px; vertical-align: 1px; }
.pill.sm .dot { width: 6px; height: 6px; box-shadow: none; }

/* números da conta */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stat {
  display: grid; gap: 4px; padding: 18px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  text-decoration: none; transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.stat:hover { border-color: var(--line-2); transform: translateY(-1px); }
.stat-label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 500; }
.stat-value { font-size: 26px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.2; margin-top: 6px; }
.stat-hint { color: var(--muted); font-size: 12.5px; }

/* dados (lista chave → valor) */
.kv { display: grid; margin: 0; }
.kv > div {
  display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 16px; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.kv > div:first-child { border-top: 0; padding-top: 4px; }
.kv dt { color: var(--muted); font-size: 14px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv.compact > div { grid-template-columns: 100px minmax(0, 1fr); padding: 9px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 3px 10px; border-radius: 999px; font-size: 13px; background: var(--surface-2); border: 1px solid var(--line); }

/* listas (sessões, apps) */
.items { list-style: none; margin: 0; padding: 0; }
.item { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; padding-top: 2px; }
.item:last-child { padding-bottom: 0; }
.item-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.item-title { font-weight: 600; overflow-wrap: anywhere; }
.empty { color: var(--muted); padding: 6px 0 2px; }

/* passos de instalação */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; display: grid; gap: 4px; }
.steps li { counter-increment: step; position: relative; display: grid; gap: 2px; padding: 10px 0 10px 44px; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 10px;
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line);
}

.hash-row { display: flex; align-items: center; gap: 8px; }
.hash {
  flex: 1; min-width: 0; display: block; padding: 7px 10px; border-radius: 8px;
  background: var(--bg-2); color: var(--text-2); overflow-wrap: anywhere;
}

/* zona de perigo */
.danger-zone { border-color: var(--danger-line); }
.danger-zone h2 { color: var(--danger); }

/* ---------- formulários e botões ---------- */
.field { display: grid; gap: 6px; }
.card form { display: grid; gap: 8px; }
.card form .btn { margin-top: 8px; }
label { display: block; font-weight: 600; font-size: 14px; }
input[type="email"], input[type="text"] {
  width: 100%; height: 46px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text); font: inherit;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
input::placeholder { color: var(--faint); }
input:hover { border-color: var(--faint); }
input:focus-visible { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px rgba(var(--glow), 0.12); }
input[aria-invalid="true"] { border-color: var(--danger); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 9px 16px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text);
  font: 600 14.5px/1.2 var(--sans); text-decoration: none; white-space: nowrap;
  transition: background 0.18s var(--ease), transform 0.15s var(--ease), opacity 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--text); color: rgb(var(--on-rgb)); border-color: var(--text); }
.btn.primary:hover { box-shadow: 0 10px 30px -12px rgba(var(--glow), 0.45); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger-line); }
.btn.danger:hover { background: var(--danger-fill); }
.btn.danger-solid { background: var(--danger); color: rgb(var(--on-rgb)); border-color: var(--danger); }
.btn.danger-solid:hover { opacity: 0.9; }
.btn.link { background: none; border: 0; padding: 0; min-height: 0; text-decoration: underline; font-weight: 500; color: var(--muted); }
.btn.link:hover { color: var(--text); }
.btn.block { width: 100%; }
.btn.sm { min-height: 34px; padding: 6px 12px; font-size: 13.5px; border-radius: 10px; }
.btn.lg { min-height: 50px; padding: 12px 22px; font-size: 15.5px; border-radius: 14px; }
.btn[aria-busy="true"] { cursor: progress; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.icon-btn {
  flex: none; width: 34px; height: 34px; display: grid; place-items: center;
  border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- avisos ---------- */
.alert { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2); display: grid; gap: 4px; }
.alert.error { border-color: var(--danger-line); background: var(--danger-fill); color: var(--danger); }
.alert.success { border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: var(--ok-fill); }
.alert:empty { display: none; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 40;
  max-width: min(92vw, 420px); padding: 11px 16px; border-radius: 12px;
  background: var(--text); color: rgb(var(--on-rgb)); font-weight: 500; font-size: 14px;
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.5);
  opacity: 0; transform: translate(-50%, 12px); pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}
.toast:empty { display: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- esqueleto de carregamento ---------- */
.skel-group { display: grid; gap: 10px; }
.skel {
  display: block; height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.skel-s { width: 28%; }
.skel-m { width: 55%; }
.skel-l { width: 85%; height: 18px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---------- diálogo de confirmação ---------- */
.modal {
  width: min(92vw, 420px); padding: 24px; border: 1px solid var(--line-2); border-radius: var(--radius-lg);
  background: var(--surface); color: var(--text); box-shadow: 0 30px 80px -24px rgba(0, 0, 0, 0.6);
}
.modal[open] { display: grid; gap: 10px; animation: pop 0.22s var(--ease); }
.modal::backdrop { background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(3px); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

/* ---------- celular e tablet ---------- */
@media (max-width: 860px) {
  .layout { display: block; }
  .side { display: none; }
  .topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: blur(14px);
  }
  .top-brand .wordmark { height: 26px; }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    display: grid; grid-template-columns: repeat(4, 1fr);
    height: calc(var(--tab-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(14px);
  }
  .tab-link {
    display: grid; justify-items: center; align-content: center; gap: 3px;
    color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 500;
  }
  .tab-link[aria-current="page"] { color: var(--text); }
  .tab-link[aria-current="page"] .ico { transform: translateY(-1px); }
  .content { padding: 24px 16px calc(var(--tab-h) + 32px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom)); }
}

@media (max-width: 600px) {
  h1 { font-size: 24px; }
  .card, .hero { padding: 18px; border-radius: var(--radius); }
  .hero h2 { font-size: 19px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats .stat:first-child { grid-column: 1 / -1; }
  .stat { padding: 14px; border-radius: var(--radius); }
  .stat-value { font-size: 22px; }
  .kv > div, .kv.compact > div { grid-template-columns: 1fr; gap: 2px; }
  .row-card { grid-template-columns: 1fr; }
  .row-card .btn, .actions .btn { width: 100%; }
  /* ícone + texto em cima; o botão embaixo, alinhado ao texto */
  .item { display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 14px; row-gap: 10px; }
  .item > .btn { grid-column: 2; justify-self: start; width: auto; }
  .modal-actions .btn { flex: 1; }
}

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