/* Painel no mesmo visual do aplicativo: azul-marinho escuro, cartões translúcidos e o degradê azul → roxo. */
:root {
  --bg: #050a14;
  --bg-2: #0e1a33;
  --card: rgba(255, 255, 255, .04);
  --card-hover: rgba(255, 255, 255, .07);
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .16);
  --text: #eef2fb;
  --muted: #8d99b8;
  --cyan: #2ec5ff;
  --blue: #4f78ff;
  --purple: #b14bff;
  --green: #3ddc97;
  --amber: #ffb547;
  --red: #ff5c7a;
  --brand: linear-gradient(135deg, var(--cyan), var(--blue) 50%, var(--purple));
  --radius: 16px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(180deg, var(--bg-2), var(--bg) 60%) fixed;
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .9rem; }
h3 { font-size: .95rem; margin: 1.6rem 0 .8rem; }
p { margin: 0 0 .8rem; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .03em; }
.text-danger { color: var(--red) !important; }
.text-warn { color: var(--amber) !important; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }

/* ---------- Estrutura: menu à esquerda, conteúdo à direita ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px; flex: none; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 1.5rem;
  padding: 1.4rem 1rem; border-right: 1px solid var(--border);
  background: rgba(5, 10, 20, .55); backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: .7rem; color: var(--text); font-size: 1.05rem; padding: 0 .5rem; }
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; }
.brand b { background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; font-size: .8rem; letter-spacing: .12em; margin-left: .2rem; }

.sidebar nav { display: flex; flex-direction: column; gap: .25rem; }
.sidebar nav a {
  display: flex; align-items: center; gap: .75rem; padding: .65rem .8rem; border-radius: 12px;
  color: var(--muted); font-weight: 500; position: relative;
}
.sidebar nav a:hover { background: var(--card-hover); color: var(--text); text-decoration: none; }
.sidebar nav a.active { background: linear-gradient(90deg, rgba(46, 197, 255, .16), rgba(177, 75, 255, .06)); color: var(--text); }
.sidebar nav a.active::before {
  content: ""; position: absolute; left: 0; top: 22%; bottom: 22%; width: 3px; border-radius: 3px; background: var(--brand);
}

.who { margin-top: auto; display: flex; align-items: center; gap: .7rem; padding: .8rem; border-radius: 14px; background: var(--card); border: 1px solid var(--border); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--brand); flex: none; }
.who-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.who-text strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-text span { font-size: .78rem; color: var(--muted); }
.icon-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: .3rem; border-radius: 8px; display: grid; place-items: center; }
.icon-btn:hover { color: var(--text); background: var(--card-hover); }

.content { flex: 1; min-width: 0; padding: 2rem 2.2rem 3rem; max-width: 1200px; }
.content.bare { max-width: none; padding: 0; }

/* ---------- Cabeçalho das páginas ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.page-head .sub { color: var(--muted); margin-top: .25rem; }
.back { color: var(--muted); font-size: .9rem; display: inline-block; margin-bottom: .35rem; }

/* ---------- Cartões ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.4rem; margin-bottom: 1.2rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .9rem; }
.card-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.2rem; margin-bottom: 1.2rem; }
.grid-2 > .card { margin-bottom: 0; }

/* ---------- Números do início ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.4rem; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; position: relative; overflow: hidden; }
.stat::after { content: ""; position: absolute; inset: auto 0 0 0; height: 3px; background: var(--accent, var(--brand)); opacity: .9; }
.stat .value { font-size: 2rem; font-weight: 700; line-height: 1.1; }
.stat .label { color: var(--muted); font-size: .88rem; }
.stat.green { --accent: var(--green); }
.stat.amber { --accent: var(--amber); }
.stat.red { --accent: var(--red); }
.stat.cyan { --accent: var(--cyan); }
.stat.purple { --accent: var(--purple); }

/* ---------- Formulários ---------- */
input, select, textarea {
  background: rgba(0, 0, 0, .25); border: 1px solid var(--border-strong); color: var(--text);
  border-radius: 12px; padding: .65rem .85rem; font: inherit; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(177, 75, 255, .18); }
input::placeholder { color: #66718f; }
label { display: flex; flex-direction: column; gap: .35rem; font-size: .86rem; color: var(--muted); flex: 1; }
label input, label select, label textarea { color: var(--text); font-size: .95rem; }
.inline { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.inline input { flex: 1; min-width: 180px; }
.inline.compact input, .inline.compact select { min-width: 0; flex: none; padding: .4rem .6rem; }
.stack { display: flex; flex-direction: column; gap: .9rem; }
.row { display: flex; gap: .9rem; flex-wrap: wrap; }
.row > label { min-width: 200px; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  background: var(--card-hover); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: 999px; padding: .6rem 1.15rem; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, .12); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: transparent; box-shadow: 0 6px 20px rgba(79, 120, 255, .25); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--red); border-color: transparent; }
.btn.danger-outline { border-color: rgba(255, 92, 122, .5); color: #ff8aa0; background: transparent; }
.btn.danger-outline:hover { background: rgba(255, 92, 122, .12); }
.btn.small { padding: .35rem .8rem; font-size: .85rem; }
.btn.block { width: 100%; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }
.actions form { margin: 0; }

/* ---------- Avisos ---------- */
.flash { padding: .8rem 1rem; border-radius: 12px; margin-bottom: 1.2rem; border: 1px solid; }
.flash.success { background: rgba(61, 220, 151, .1); border-color: rgba(61, 220, 151, .35); color: #8ff0c4; }
.flash.error { background: rgba(255, 92, 122, .1); border-color: rgba(255, 92, 122, .35); color: #ff9db0; }

/* ---------- Etiquetas de situação ---------- */
.badge { display: inline-block; padding: .18rem .7rem; border-radius: 999px; font-size: .78rem; font-weight: 700; border: 1px solid; white-space: nowrap; }
.badge.active { color: var(--green); background: rgba(61, 220, 151, .12); border-color: rgba(61, 220, 151, .4); }
.badge.pending { color: var(--amber); background: rgba(255, 181, 71, .12); border-color: rgba(255, 181, 71, .4); }
.badge.blocked, .badge.expired { color: var(--red); background: rgba(255, 92, 122, .12); border-color: rgba(255, 92, 122, .4); }
.badge.off { color: var(--muted); background: rgba(255, 255, 255, .05); border-color: var(--border-strong); }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; margin: 0 -.4rem; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: .6rem .8rem; border-bottom: 1px solid var(--border); }
td { padding: .75rem .8rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: rgba(255, 255, 255, .025); }
tbody tr:last-child td { border-bottom: 0; }
td.ellipsis { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-action { text-align: right; width: 1%; white-space: nowrap; }
.row-action form { display: inline-block; margin: 0; }
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }

/* ---------- Detalhes ---------- */
dl.info { display: grid; grid-template-columns: 140px 1fr; gap: .55rem 1rem; margin: 0 0 1.2rem; }
dl.info dt { color: var(--muted); }
dl.info dd { margin: 0; }

/* ---------- Assinatura ---------- */
.plan-hero { text-align: center; padding: 2.2rem 1.4rem; }
.plan-hero .big { font-size: 2.6rem; font-weight: 800; margin: .3rem 0; background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.plan-hero.expired .big { background: none; color: var(--red); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login { width: 100%; max-width: 400px; padding: 2.2rem; text-align: left; }
.login-logo { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.6rem; font-size: 1.15rem; }
.login-logo img { width: 44px; height: 44px; }
.login h1 { font-size: 1.4rem; margin-bottom: .2rem; }
.login form { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.4rem; }
.center { text-align: center; max-width: 480px; margin: 4rem auto; }

/* ---------- Celular: menu vira barra no topo ---------- */
@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: auto; height: auto; position: sticky; z-index: 5; flex-direction: row; align-items: center;
    gap: .6rem; padding: .7rem 1rem; border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto;
  }
  .brand span { display: none; }
  .sidebar nav { flex-direction: row; }
  .sidebar nav a { padding: .5rem .7rem; font-size: .88rem; white-space: nowrap; }
  .sidebar nav a.active::before { left: 22%; right: 22%; top: auto; bottom: 0; width: auto; height: 3px; }
  .who { margin: 0 0 0 auto; padding: .3rem; background: none; border: 0; }
  .who-text, .avatar { display: none; }
  .content { padding: 1.2rem 1rem 2.5rem; }
  dl.info { grid-template-columns: 1fr; gap: .1rem; }
  dl.info dd { margin-bottom: .6rem; }
}

/* ---------- Planos e pagamento Pix ---------- */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.plan { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.3rem; display: flex; flex-direction: column; gap: .35rem; }
.plan:hover { border-color: rgba(177, 75, 255, .45); }
.plan-name { font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; }
.plan-price { font-size: 1.7rem; font-weight: 800; }
.plan-saving { color: var(--green); font-size: .85rem; font-weight: 600; }
.plan .btn { margin-top: auto; }
.plan .muted { margin-bottom: .4rem; }

.pix { display: flex; gap: 2rem; align-items: center; flex-wrap: wrap; }
.pix-qr img { width: 240px; height: 240px; background: #fff; padding: 12px; border-radius: 14px; display: block; }
.pix-info { flex: 1; min-width: 260px; }
.copy-row { display: flex; gap: .6rem; margin: 1rem 0; }
.copy-row input { flex: 1; font-family: ui-monospace, Consolas, monospace; font-size: .8rem; }
.pix-wait { display: flex; align-items: center; gap: .7rem; color: var(--muted); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--purple); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Personalização ---------- */
.logo-box { height: 110px; border-radius: 14px; border: 1px dashed var(--border-strong); background: rgba(0, 0, 0, .25); display: grid; place-items: center; padding: 12px; }
.logo-box img { max-width: 100%; max-height: 86px; object-fit: contain; }
.file-btn { flex: none; color: var(--text); font-size: inherit; }
.tv-preview { aspect-ratio: 16 / 9; border-radius: 14px; padding: 4%; display: flex; flex-direction: column; gap: 5%;
  background: radial-gradient(ellipse at 45% 110%, #0e2e57, transparent 60%), #050a14; border: 1px solid var(--border); margin-bottom: 1rem; }
.tv-top { display: flex; justify-content: space-between; align-items: center; min-height: 14%; }
.tv-logo img { max-height: 34px; max-width: 150px; object-fit: contain; display: block; }
.tv-support { font-size: .72rem; background: rgba(255, 255, 255, .08); border-radius: 999px; padding: .2rem .7rem; }
.tv-tiles { flex: 1; display: flex; gap: 3%; }
.tv-tile { background: rgba(53, 59, 75, .85); border-radius: 10px; display: grid; place-items: center; font-size: .72rem; font-weight: 600; }
.tv-tile.big { flex: 1.2; background: #3d7be8; }
.tv-grid { flex: 2; display: grid; grid-template-columns: 1fr 1fr; gap: 6%; }
.tv-default-logo { display: flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 700; }
.tv-default-logo img { width: 22px; height: 22px; }
.tv-default-logo b { color: #8f7bff; font-size: .62rem; letter-spacing: .1em; }
.tv-notice { align-self: center; max-width: 90%; font-size: .68rem; background: rgba(46, 197, 255, .14); border: 1px solid rgba(46, 197, 255, .35);
  border-radius: 999px; padding: .2rem .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
textarea { resize: vertical; font-family: inherit; }

/* ---------- Páginas públicas (privacidade, exclusão de dados) ---------- */
.doc { max-width: 820px; margin: 0 auto; padding: 2.5rem 1.2rem 3rem; }
.doc-brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.4rem; }
.doc-brand img { width: 36px; height: 36px; }
.doc-brand b { color: #8f7bff; font-size: .8rem; letter-spacing: .1em; }
.doc h1 { margin-bottom: .3rem; }
.doc > .muted { margin-bottom: 1.4rem; }
.doc ul, .doc ol { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: .5rem; }
.doc .card p:last-child { margin-bottom: 0; }

/* ---------- Código de acesso ---------- */
.code-card { display: flex; align-items: center; gap: 1.6rem; flex-wrap: wrap; }
.code-card p { flex: 1; min-width: 240px; margin: 0; }
.access-code { font-size: 2rem; font-weight: 800; letter-spacing: .18em; background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.link-card { color: inherit; text-decoration: none; }
.link-card:hover { text-decoration: none; border-color: rgba(177, 75, 255, .45); }

/* ---------- Aba Códigos ---------- */
.access-code.small { font-size: 1.3rem; }
.code-list { display: flex; flex-direction: column; gap: 1rem; }
.code-item { border: 1px solid var(--border); border-radius: 14px; padding: 1rem 1.1rem; background: rgba(0, 0, 0, .15); }
.code-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.code-top .actions { margin-top: 0; }
.code-name { display: flex; align-items: center; gap: .8rem; }
.code-edit { align-items: flex-end; }
.code-edit > label { min-width: 160px; }
.code-save { flex: none; }
