/* AvatarLab — design system compartilhado (site, conta, admin) */
:root {
  --primary: #6d5efc;
  --accent: #22c3a6;
  --bg: #0f1222;
  --surface: #171a2e;
  --surface-2: #1e2238;
  --border: #2a2f4a;
  --text: #e8eaf6;
  --muted: #9aa0c3;
  --danger: #ff5c7a;
  --warning: #ffb547;
  --success: #2fd391;
  --info: #5cb8ff;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .25);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
[data-theme="light"] {
  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-2: #f0f1f8;
  --border: #e1e3ef;
  --text: #1c2036;
  --muted: #6b7090;
  --shadow: 0 8px 24px rgba(30, 35, 70, .08);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .6em; letter-spacing: -.01em; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
code, pre, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; }
pre { background: var(--surface-2); border: 1px solid var(--border); padding: 14px; border-radius: 10px; overflow: auto; max-height: 520px; white-space: pre-wrap; word-break: break-word; }
hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; } .right { text-align: right; }
.nowrap { white-space: nowrap; } .mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; } .mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.hidden { display: none !important; }

/* Botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 10px; border: 1px solid transparent; background: var(--primary); color: #fff; font-weight: 600; font-size: .92rem; cursor: pointer; text-decoration: none !important; transition: filter .15s, transform .05s; font-family: inherit; line-height: 1.2; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-danger { background: var(--danger); }
.btn-success { background: var(--success); color: #062a1b; }
.btn-accent { background: var(--accent); color: #05231d; }
.btn-sm { padding: 6px 12px; font-size: .82rem; border-radius: 8px; }
.btn-lg { padding: 14px 26px; font-size: 1.02rem; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; color: var(--primary); padding: 0; cursor: pointer; font: inherit; }
.btn-link.danger { color: var(--danger); }

/* Formulários */
label { display: block; font-weight: 600; font-size: .86rem; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.help { color: var(--muted); font-size: .8rem; margin-top: 4px; font-weight: 400; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=date], input[type=datetime-local], input[type=search], input[type=tel], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: .93rem; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
textarea { min-height: 110px; resize: vertical; }
textarea.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .84rem; min-height: 220px; }
input[type=color] { width: 56px; height: 40px; padding: 2px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; }
input[type=file] { color: var(--muted); font-size: .85rem; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; margin-bottom: 10px; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch input { appearance: none; width: 42px; height: 24px; border-radius: 99px; background: var(--border); position: relative; cursor: pointer; transition: background .2s; flex-shrink: 0; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(18px); }
.input-group { display: flex; gap: 8px; align-items: stretch; }
.input-group > * { flex: 1; }
.input-group > .btn, .input-group > .addon { flex: 0 0 auto; }
.addon { display: flex; align-items: center; padding: 0 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; color: var(--muted); font-size: .88rem; }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }

/* Layout utilitários */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 16px; }
@media (max-width: 960px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-header h2, .card-header h3 { margin: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-header { padding: 16px 20px 0; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat .value { font-size: 1.6rem; font-weight: 700; }
.stat .delta { font-size: .8rem; }
.delta.up { color: var(--success); } .delta.down { color: var(--danger); }

/* Tabelas */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }
.empty { padding: 36px; text-align: center; color: var(--muted); }

/* Badges / alerts */
.badge { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: .74rem; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.badge-success { background: color-mix(in srgb, var(--success) 18%, transparent); color: var(--success); }
.badge-danger { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.badge-warning { background: color-mix(in srgb, var(--warning) 18%, transparent); color: var(--warning); }
.badge-info { background: color-mix(in srgb, var(--info) 18%, transparent); color: var(--info); }
.badge-muted { background: var(--surface-2); color: var(--muted); }
.badge-primary { background: color-mix(in srgb, var(--primary) 22%, transparent); color: var(--primary); }
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; border: 1px solid; font-size: .92rem; display: flex; gap: 10px; align-items: flex-start; }
.alert-success { background: color-mix(in srgb, var(--success) 12%, transparent); border-color: color-mix(in srgb, var(--success) 40%, transparent); }
.alert-error { background: color-mix(in srgb, var(--danger) 12%, transparent); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.alert-warning { background: color-mix(in srgb, var(--warning) 12%, transparent); border-color: color-mix(in srgb, var(--warning) 40%, transparent); }
.alert-info { background: color-mix(in srgb, var(--info) 12%, transparent); border-color: color-mix(in srgb, var(--info) 40%, transparent); }
.alert .close { margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; font-size: 1.1rem; opacity: .6; }

/* Tabs / pills */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; font-size: .9rem; border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; }
.tabs a.active { color: var(--text); border-color: var(--primary); }
.pills { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; padding: 4px; gap: 4px; }
.pills a, .pills button { padding: 7px 14px; border-radius: 99px; color: var(--muted); font-weight: 600; font-size: .85rem; background: none; border: 0; cursor: pointer; text-decoration: none; font-family: inherit; }
.pills .active { background: var(--primary); color: #fff; }

/* Paginação */
.pagination { display: flex; gap: 6px; justify-content: center; padding: 16px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); font-size: .85rem; color: var(--text); text-decoration: none; }
.pagination .current { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Filtros */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters > * { flex: 0 1 200px; }
.filters .grow { flex: 1 1 260px; }

/* Definição */
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: .92rem; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; word-break: break-word; }

/* ── Admin shell ── */
.admin { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; color: var(--text); padding: 4px 8px 18px; text-decoration: none !important; }
.brand img { max-height: 32px; }
.brand .dot { width: 28px; height: 28px; border-radius: 9px; background: linear-gradient(135deg, var(--primary), var(--accent)); display: inline-block; }
.nav-group { margin-bottom: 14px; }
.nav-title { font-size: .68rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 700; padding: 6px 10px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--muted); font-weight: 500; font-size: .9rem; text-decoration: none; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: color-mix(in srgb, var(--primary) 18%, transparent); color: var(--text); }
.nav a .ico { width: 18px; text-align: center; opacity: .9; }
.nav a .count { margin-left: auto; background: var(--danger); color: #fff; border-radius: 99px; font-size: .7rem; padding: 1px 7px; font-weight: 700; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 28px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.topbar .title { font-weight: 700; font-size: 1.05rem; }
.content { padding: 26px 28px 60px; max-width: 1280px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: 4px; }
.menu-toggle { display: none; background: none; border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
@media (max-width: 900px) {
  .admin { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .menu-toggle { display: inline-block; }
  .content { padding: 18px 16px 60px; }
  .topbar { padding: 12px 16px; }
}

/* Gráfico simples */
.chart { width: 100%; height: 220px; }
.bar-list { display: flex; flex-direction: column; gap: 10px; }
.bar-list .bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar-list .bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); }

/* Checklist */
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: .9rem; }
.checklist li:last-child { border: 0; }
.checklist .ok { color: var(--success); } .checklist .todo { color: var(--warning); }

/* Modal leve */
dialog { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); padding: 22px; max-width: 520px; width: 92%; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(5, 6, 15, .6); }

/* ── Site público ── */
.site-header { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(12px); background: color-mix(in srgb, var(--bg) 80%, transparent); border-bottom: 1px solid var(--border); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.site-nav { display: flex; gap: 18px; align-items: center; }
.site-nav a:not(.btn) { color: var(--muted); font-weight: 600; font-size: .92rem; }
.wrap { max-width: 1140px; margin: 0 auto; padding: 0 20px; }
.hero { padding: 90px 0 70px; text-align: center; position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: -40% -10% auto; height: 520px; background: radial-gradient(closest-side, color-mix(in srgb, var(--primary) 35%, transparent), transparent), radial-gradient(closest-side, color-mix(in srgb, var(--accent) 25%, transparent), transparent) 60% 40% / 60% 100% no-repeat; filter: blur(30px); z-index: -1; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.4rem); max-width: 820px; margin: 0 auto 18px; font-weight: 800; }
.hero p { color: var(--muted); font-size: 1.12rem; max-width: 680px; margin: 0 auto 30px; }
.section { padding: 70px 0; }
.section h2 { font-size: 1.9rem; text-align: center; }
.section .lead { text-align: center; color: var(--muted); max-width: 640px; margin: 0 auto 40px; }
.feature { padding: 24px; }
.feature .icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; background: color-mix(in srgb, var(--primary) 18%, transparent); margin-bottom: 14px; }
.price-card { display: flex; flex-direction: column; position: relative; }
.price-card.featured { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), var(--shadow); }
.price-card .ribbon { position: absolute; top: -12px; right: 18px; background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(0,0,0,.3); }
.price { font-size: 2.2rem; font-weight: 800; margin: 8px 0 2px; }
.price small { font-size: .95rem; color: var(--muted); font-weight: 500; }
.price-card ul { list-style: none; padding: 0; margin: 18px 0 24px; flex: 1; }
.price-card li { padding: 6px 0 6px 26px; position: relative; font-size: .93rem; }
.price-card li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 800; }
.site-footer { border-top: 1px solid var(--border); padding: 30px 0; color: var(--muted); font-size: .88rem; }
.auth-box { max-width: 420px; margin: 60px auto; }
.auth-box .card { padding: 28px; }
.page { padding: 40px 0 70px; }
.account-shell { display: grid; grid-template-columns: 220px 1fr; gap: 24px; }
@media (max-width: 800px) { .account-shell { grid-template-columns: 1fr; } .site-nav .hide-sm { display: none; } }
.legal { max-width: 800px; }
.legal h2 { margin-top: 1.4em; }
