:root {
  --bg: #0b1020;
  --bg-soft: #141a2e;
  --card: #171e35;
  --text: #f4f7fb;
  --muted: #97a3c0;
  --accent: #2f6bff;
  --accent-2: #22d3ee;
  /* Erro tem cor própria: antes reusava o rosa da marca, então mudar a identidade
     visual mudava junto a cor de "algo deu errado". */
  --danger: #f43f5e;
  --ok: #4ade80;
  --border: rgba(255, 255, 255, 0.08);
  --radius: 16px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

a { color: inherit; text-decoration: none; }

/* ---------- Botões ---------- */
.btn-Shrt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  padding: .85rem 1.4rem;
  border-radius: 999px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn-Shrt:hover { transform: translateY(-2px); }
.btn-primary-Shrt {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 8px 24px rgba(47, 107, 255, .35);
}
.btn-ghost-Shrt {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost-Shrt:hover { background: rgba(255,255,255,.06); }
.btn-sm { padding: .45rem .85rem; font-size: .85rem; border-radius: 999px; }
.btn-danger-Shrt { background: rgba(244,63,94,.15); color: var(--danger); border: 1px solid rgba(244,63,94,.3); }
.btn-danger-Shrt:hover { background: rgba(244,63,94,.25); }
button[disabled] { opacity: .5; cursor: not-allowed; }
button[disabled]:hover { transform: none; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 16, 32, .8);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand { font-weight: 800; font-size: 1.35rem; letter-spacing: -.03em; }
.topbar .brand span {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.topbar nav { display: flex; gap: 1.1rem; align-items: center; flex-wrap: wrap; }
.topbar nav a { color: var(--muted); font-weight: 500; }
.topbar nav a:hover { color: var(--text); }
.topbar nav a.btn-Shrt { color: var(--text); }
.topbar nav a.btn-primary-Shrt { color: #fff; }

/* Ícone dentro de botão/link */
.ico { width: 1em; height: 1em; flex-shrink: 0; vertical-align: -0.125em; }

/* Seletor de idioma */
.lang-switch { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; }
.lang-switch a { color: var(--muted); font-weight: 600; }
.lang-switch a.on { color: var(--accent-2); }
.lang-switch .sep { color: var(--border); }

/* Chip do usuário logado */
.user-chip { display: inline-flex; align-items: center; gap: .5rem; }
.avatar-mini {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-weight: 800; font-size: .8rem; flex-shrink: 0;
}
.user-name { color: var(--text); font-weight: 600; font-size: .9rem; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 720px) { .user-name { display: none; } }

.container-Shrt { max-width: 960px; margin: 0 auto; padding: 2rem 1.5rem; }

/* ---------- Landing: herói ---------- */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 5rem 1.5rem 4rem;
  background: radial-gradient(1200px 600px at 50% -10%, rgba(47,107,255,.28), transparent 60%),
              radial-gradient(900px 500px at 90% 20%, rgba(34,211,238,.14), transparent 60%);
}
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1.05;
  margin: 0 0 1rem;
  font-weight: 800;
  letter-spacing: -.03em;
}
.hero h1 .grad {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.sub { font-size: 1.2rem; color: var(--muted); max-width: 580px; margin: 0 auto 2.25rem; }
.hero .cta { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }

/* Demonstração do domínio curto */
.url-demo {
  display: inline-flex;
  align-items: center;
  gap: .1rem;
  margin: 0 auto 2.25rem;
  padding: 1rem 1.5rem;
  border-radius: 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(1rem, 3vw, 1.5rem);
  font-weight: 600;
  box-shadow: var(--shadow);
  max-width: 100%;
  overflow-x: auto;
}
.url-demo .host { color: var(--muted); }
.url-demo .slug {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.url-demo .long { color: var(--muted); text-decoration: line-through; opacity: .55; font-size: .8em; }
.url-demo .arrow { color: var(--muted); padding: 0 .75rem; text-decoration: none; }

/* ---------- Seções ---------- */
.section { max-width: 960px; margin: 0 auto; padding: 3.5rem 1.5rem; }
.section h2 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); text-align: center; margin: 0 0 .6rem; letter-spacing: -.02em; }
.section .section-sub { color: var(--muted); text-align: center; max-width: 560px; margin: 0 auto 2.5rem; }

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}
.feature {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.feature .ico { font-size: 1.8rem; margin-bottom: .6rem; }
.feature h3 { margin: .2rem 0 .4rem; font-size: 1.05rem; }
.feature p { color: var(--muted); margin: 0; font-size: .95rem; line-height: 1.55; }

/* Passos */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; }
.step { text-align: center; padding: 1rem; }
.step .num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-weight: 800; margin-bottom: .75rem;
}
.step h3 { margin: 0 0 .35rem; font-size: 1.02rem; }
.step p { color: var(--muted); margin: 0; font-size: .92rem; line-height: 1.55; }

/* ---------- Preços ---------- */
.pricing {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  align-items: start;
}
.price-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
}
.price-card.featured {
  border-color: rgba(47,107,255,.55);
  box-shadow: 0 12px 40px rgba(47,107,255,.18);
}
.price-card .tag {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: .72rem; font-weight: 700;
  padding: .3rem .8rem; border-radius: 999px; letter-spacing: .04em; text-transform: uppercase;
  white-space: nowrap;
}
.price-card h3 { margin: 0; font-size: 1.2rem; }
.price-card .price { font-size: 2.4rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.price-card .price small { font-size: .95rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.price-card ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .6rem; }
.price-card li { color: var(--muted); font-size: .93rem; display: flex; gap: .55rem; align-items: flex-start; line-height: 1.45; }
.price-card li::before { content: "✓"; color: var(--accent-2); font-weight: 800; flex-shrink: 0; }
.price-card li.off { opacity: .5; }
.price-card li.off::before { content: "—"; color: var(--muted); }
.price-card .btn-Shrt { width: 100%; margin-top: auto; }
/* só o plano grátis (Billing:Enabled desligado): sem isso o card esticaria a seção inteira */
.pricing.single { grid-template-columns: minmax(260px, 380px); justify-content: center; }

/* ---------- Anúncios ---------- */
/* O iframe tem o tamanho fixo do formato (728x90 / 468x60); em telas menores que o
   formato o shrtAds reduz com transform e ajusta a altura do slot. */
.ad-slot { display: flex; justify-content: center; margin: 1.5rem auto; max-width: 100%; overflow: hidden; }
.ad-slot:empty { display: none; }
.ad-slot iframe { border: 0; display: block; transform-origin: top center; flex-shrink: 0; }

/* ---------- FAQ ---------- */
.faq { display: flex; flex-direction: column; gap: .75rem; max-width: 720px; margin: 0 auto; }
.faq details {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
}
.faq summary { cursor: pointer; font-weight: 600; }
.faq summary::marker { color: var(--accent); }
.faq p { color: var(--muted); margin: .75rem 0 0; font-size: .93rem; line-height: 1.6; }

/* ---------- Seletor de idioma ---------- */
.lang-switch { display: inline-flex; gap: .15rem; padding: .2rem; border: 1px solid var(--border); border-radius: 999px; }
.lang-switch a,
.lang-switch button {
  padding: .2rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700; letter-spacing: .04em;
  color: var(--muted); background: transparent; border: none; cursor: pointer; font-family: inherit;
}
.lang-switch a:hover, .lang-switch button:hover { color: var(--text); }
.lang-switch .active { background: rgba(255,255,255,.1); color: var(--text); }
.topbar nav .lang-switch a { color: var(--muted); }
.topbar nav .lang-switch a.active { color: var(--text); }

/* ---------- Páginas legais ---------- */
.section.legal { max-width: 760px; }
.legal-body { color: var(--muted); line-height: 1.7; display: flex; flex-direction: column; gap: 1.5rem; }
.legal-body h3 { color: var(--text); }
.legal-body a { color: var(--accent-2); }
.legal-notice {
  color: var(--muted); font-size: .85rem; text-align: center; margin: -1.5rem auto 2rem; max-width: 560px;
  padding: .6rem 1rem; border: 1px solid var(--border); border-radius: 12px;
}
.legal-notice:empty { display: none; }

/* ---------- Aviso de cookies ---------- */
/* Global (antes era CSS isolado do componente do WASM, e o aviso do site público ficava sem estilo) */
.cookie-consent {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    z-index: 9999;
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.cookie-consent p {
    flex: 1 1 260px;
    margin: 0;
    color: var(--muted);
    font-size: .9rem;
    line-height: 1.5;
}

.cookie-consent a {
    color: var(--accent-2);
}

.cookie-consent button {
    flex: 0 0 auto;
    padding: .6rem 1.4rem;
    border: none;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.cookie-consent button:hover {
    filter: brightness(1.1);
}

@media (max-width: 480px) {
    .cookie-consent {
        left: .5rem;
        right: .5rem;
        bottom: .5rem;
        padding: .85rem 1rem;
    }
}

/* ---------- Anúncio fixo no rodapé do painel ---------- */
/* z-index abaixo do modal de QR (50) e acima da topbar (10) */
.ad-sticky {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  padding: .35rem 0 calc(.35rem + env(safe-area-inset-bottom, 0px));
  background: var(--bg-soft); border-top: 1px solid var(--border);
  box-shadow: 0 -8px 24px rgba(0,0,0,.35);
}
.ad-sticky .ad-slot { margin: 0 auto; }
.ad-sticky-close {
  position: absolute; top: -13px; right: 12px; width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--card); color: var(--muted); border: 1px solid var(--border); cursor: pointer; font-size: .75rem;
}
.ad-sticky-close:hover { color: var(--text); }
/* reserva a altura do anúncio para ele não cobrir o fim do conteúdo */
.page.has-ad-sticky { padding-bottom: 110px; }
@media (max-width: 767px) { .page.has-ad-sticky { padding-bottom: 80px; } }

/* ---------- Rodapé ---------- */
.site-foot {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
}
.site-foot a { color: var(--text); }

/* ---------- Login ---------- */
.auth-wrap { min-height: 82vh; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
}
.auth-card h1 { margin: 0 0 .5rem; }
.auth-card p { color: var(--muted); margin: 0 0 1.75rem; }
.btn-google {
  display: inline-flex; align-items: center; gap: .75rem;
  width: 100%; justify-content: center;
  padding: .85rem 1.25rem; border-radius: 12px;
  background: #fff; color: #1f1f1f; font-weight: 600; border: none; cursor: pointer;
  transition: box-shadow .12s ease, transform .12s ease;
}
.btn-google:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(0,0,0,.3); }
.btn-google svg { width: 20px; height: 20px; }

/* ---------- Painel ---------- */
.admin-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.admin-header h1 { margin: 0; }
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.panel h1 { margin-top: 0; }
.panel h2 { margin-top: 0; font-size: 1.15rem; }

/* Medidor de uso do plano */
.quota { display: flex; flex-direction: column; gap: .5rem; }
.quota-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.quota-bar { height: 8px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; border: 1px solid var(--border); }
.quota-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; }
.quota-fill.full { background: linear-gradient(90deg, var(--danger), #fb923c); }

.plan-badge {
  display: inline-block; padding: .2rem .6rem; border-radius: 999px;
  font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.plan-badge.free { background: rgba(255,255,255,.08); color: var(--muted); }
.plan-badge.pro { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }

/* Tabela de links */
table.links-table { width: 100%; border-collapse: collapse; }
table.links-table th, table.links-table td { padding: .75rem .6rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.links-table th { color: var(--muted); font-weight: 600; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
table.links-table a.url { color: var(--accent-2); word-break: break-all; font-weight: 600; }
table.links-table td.target {
  color: var(--muted); font-size: .88rem;
  max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
tr.row-inactive { opacity: .5; }
.row-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.row-actions form { margin: 0; }

.badge {
  display: inline-block; margin-left: .4rem; padding: .1rem .45rem;
  border-radius: 6px; font-size: .68rem; font-weight: 700;
  background: rgba(47,107,255,.18); color: #9ec1ff;
  text-transform: uppercase; letter-spacing: .03em;
}
.badge-off { background: rgba(255,255,255,.08); color: var(--muted); }
.badge-on { color: var(--ok); font-weight: 600; }

/* Formulários */
.form-grid { display: grid; gap: 1rem; }
.field label { display: block; margin-bottom: .35rem; font-weight: 600; font-size: .9rem; }
.field input[type=text], .field input[type=url], .field input[type=number], .field input[type=email], .field textarea, .field select {
  width: 100%;
  padding: .7rem .85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-size: .95rem;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--accent); }
.field input[disabled] { opacity: .5; }
.text-danger { color: var(--danger); font-size: .85rem; }
.form-actions { display: flex; gap: .75rem; margin-top: .5rem; align-items: center; flex-wrap: wrap; }

.alert-success { background: rgba(74,222,128,.12); border: 1px solid rgba(74,222,128,.3); color: #86efac; padding: .85rem 1rem; border-radius: 10px; margin-bottom: 1.25rem; }
.alert-error { background: rgba(244,63,94,.12); border: 1px solid rgba(244,63,94,.3); color: #fda4af; padding: .85rem 1rem; border-radius: 10px; margin-bottom: 1.25rem; }
.alert-warn { background: rgba(250,204,21,.1); border: 1px solid rgba(250,204,21,.3); color: #fde047; padding: .85rem 1rem; border-radius: 10px; margin-bottom: 1.25rem; }
.alert-info { background: rgba(47,107,255,.12); border: 1px solid rgba(47,107,255,.35); color: #9ec1ff; padding: .85rem 1rem; border-radius: 10px; margin-bottom: 1.25rem; }
.alert-success a, .alert-error a, .alert-warn a, .alert-info a { color: inherit; text-decoration: underline; font-weight: 700; }

/* Campo "host/slug" */
.url-field { display: flex; align-items: stretch; }
.url-field .url-prefix {
  display: flex; align-items: center;
  padding: 0 .7rem;
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 10px 0 0 10px;
  background: rgba(255,255,255,.03);
  color: var(--muted);
  font-size: .9rem;
  white-space: nowrap;
}
.url-field input[type=text] { border-radius: 0 10px 10px 0 !important; }
.hint { color: var(--muted); font-size: .82rem; }
.field small.hint { display: block; margin-top: .4rem; }
.empty-hint { color: var(--muted); margin-top: 1rem; line-height: 1.6; }
.empty-hint code {
  background: rgba(255,255,255,.06);
  padding: .1rem .35rem;
  border-radius: 5px;
  font-size: .85em;
}

/* ---------- Console do sistema (somente admin) ---------- */
.sys-banner {
  background: linear-gradient(135deg, rgba(244,63,94,.15), rgba(251,146,60,.1));
  border: 1px solid rgba(244,63,94,.3);
  color: #fda4af;
  padding: .6rem 1rem;
  border-radius: 10px;
  margin-bottom: 1.5rem;
  font-size: .85rem;
  font-weight: 600;
}
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
}
.stat .label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; margin-top: .25rem; }
.search-row { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.search-row .field { flex: 1; min-width: 220px; margin: 0; }

@media (max-width: 620px) {
  table.links-table thead { display: none; }
  table.links-table, table.links-table tbody, table.links-table tr, table.links-table td { display: block; width: 100%; }
  table.links-table tr { border: 1px solid var(--border); border-radius: 12px; margin-bottom: .75rem; padding: .5rem; }
  table.links-table td { border: none; padding: .4rem .5rem; }
  table.links-table td.target { max-width: 100%; white-space: normal; }
}
