:root {
    --bg: #fdfcfb;
    --surface: #ffffff;
    --text: #292524;
    --muted: #78716c;
    --border: #ece9e6;
    --accent: #e11d48;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(41, 37, 36, .04), 0 6px 20px rgba(41, 37, 36, .06);
    color-scheme: light;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px; }
main.container { flex: 1; padding-top: 32px; padding-bottom: 48px; }

.site-header { border-bottom: 1px solid var(--border); position: sticky; top: 0; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); z-index: 10; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; }
.brand img { border-radius: 50%; }
.nav { display: flex; gap: 16px; flex-wrap: wrap; }
.nav a { color: var(--muted); font-size: 0.95rem; }
.nav a.lang { border: 1px solid var(--border); border-radius: 999px; padding: 0 10px; font-size: 0.8rem; line-height: 1.7; }
.nav a:hover { color: var(--text); text-decoration: none; }

.hero { text-align: center; padding: 24px 0 8px; }
.hero-avatar { border-radius: 50%; border: 3px solid var(--border); object-fit: cover; }
.hero h1 { margin: 12px 0 4px; font-size: 2rem; }
.hero-sub { color: var(--muted); margin: 0; }

.social { list-style: none; display: flex; justify-content: center; gap: 12px; padding: 0; margin: 16px 0 0; }
.social a { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--muted); transition: color .15s, border-color .15s, transform .15s; }
.social a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.icon { width: 20px; height: 20px; background-color: currentColor; -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }

.prose { margin-top: 24px; }
.prose h1 { font-size: 1.8rem; line-height: 1.25; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin: 6px 0; }

.site-footer { border-top: 1px solid var(--border); padding: 20px 0; color: var(--muted); font-size: 0.875rem; text-align: center; }

/* Links públicos (linktree) + admin */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.narrow { max-width: 560px; margin: 0 auto; }
.container.wide { max-width: 1040px; }
.back { display: inline-block; margin-bottom: 8px; font-size: 0.9rem; }
.badge { display: inline-block; font-size: 0.75rem; line-height: 1.5; padding: 0 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.badge.on { color: #15803d; border-color: #bbf7d0; background: #f0fdf4; }
.badge.off { color: var(--accent); border-color: #fecdd3; background: #fff1f2; }

.tree-head { text-align: center; margin-bottom: 24px; }
.tree-head img { border-radius: 50%; border: 3px solid var(--border); object-fit: cover; }
.tree-head h1 { margin: 10px 0 2px; font-size: 1.6rem; }
.tree-head p { color: var(--muted); margin: 0; }
.tree { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 12px; }
.tree-item { position: relative; }
.tree-btn { display: grid; gap: 4px; justify-items: center; text-align: center; padding: 16px 56px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); transition: transform .15s, border-color .15s; }
.tree-btn:hover { transform: translateY(-2px); border-color: var(--accent); text-decoration: none; }
.tree-btn .t { font-weight: 600; font-size: 1.05rem; }
.tree-btn:hover .t { color: var(--accent); }
.tree-btn .d { color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }
.tree-btn.is-group { border-left: 4px solid var(--accent); }

.qr-toggle { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); z-index: 2; }
.qr-toggle.inline { position: relative; top: auto; right: auto; transform: none; display: inline-block; }
.qr-toggle.inline .qr-pop { left: 50%; right: auto; transform: translateX(-50%); }
.qr-toggle summary { list-style: none; cursor: pointer; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); border: 1px solid var(--border); background: var(--surface); }
.qr-toggle summary::-webkit-details-marker { display: none; }
.qr-toggle summary:hover, .qr-toggle[open] summary { color: var(--accent); border-color: var(--accent); }
.qr-toggle svg.i { width: 18px; height: 18px; }
.qr-pop { position: absolute; right: 0; top: 42px; width: 168px; padding: 10px; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.qr-pop img { width: 100%; display: block; }
.qr-pop a { display: block; text-align: center; font-size: 0.75rem; margin-top: 6px; }

/* formulários */
form.stack { display: grid; gap: 10px; margin-top: 12px; }
label { display: grid; gap: 4px; font-size: 0.875rem; color: var(--muted); }
input, textarea, select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; width: 100%; }
input[type=checkbox] { width: auto; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.checks { display: flex; gap: 16px; align-items: center; }
.checks label { display: flex; align-items: center; gap: 6px; }
button, .btn { font: inherit; cursor: pointer; background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; display: inline-block; }
button.ghost, .btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
button.danger { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn.sm, button.sm { padding: 3px 9px; font-size: 0.8rem; }
button.link { background: none; border: 0; padding: 0; margin: 0 4px 0 6px; color: var(--accent); font-size: inherit; }
.error { color: var(--accent); margin: 0; }

/* admin */
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.admin-head h1 { margin: 0; }
.head-actions { display: flex; gap: 8px; align-items: center; }
.head-actions form { margin: 0; }
.forms { display: grid; gap: 12px; margin: 16px 0; }
details.fold > summary { cursor: pointer; font-weight: 600; list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold[open] > summary { color: var(--accent); }
.warn { border-color: #fecdd3; background: #fff1f2; color: var(--text); margin: 12px 0; }
.hint { color: var(--muted); font-size: 0.875rem; margin: 8px 0; }

table.admin { width: 100%; border-collapse: collapse; font-size: 0.9rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.admin th { text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--bg); }
table.admin th, table.admin td { padding: 10px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.admin tr:last-child td { border-bottom: 0; }
table.admin .ord { width: 64px; }
table.admin .num { text-align: right; width: 70px; font-variant-numeric: tabular-nums; }
table.admin td.url span { display: block; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
table.admin .sub { font-size: 0.8rem; color: var(--muted); }
table.admin td.actions { white-space: nowrap; text-align: right; }
table.admin td.actions form { display: inline; }
table.admin tr.grp td { background: #fff7f8; border-top: 1px solid var(--border); }
table.admin tr.child td:nth-child(2) { padding-left: 30px; position: relative; }
table.admin tr.child td:nth-child(2)::before { content: "↳"; position: absolute; left: 12px; color: var(--muted); }
table.admin tr.dim td { opacity: .6; }
table.admin td.empty { text-align: center; color: var(--muted); padding: 24px; }
.mover { display: inline-flex; gap: 2px; }
.mover form { display: inline; margin: 0; }
button.mv { background: var(--surface); color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 0; width: 26px; height: 26px; font-size: 0.7rem; line-height: 1; }
button.mv:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
button.mv:disabled { opacity: .3; cursor: default; }

@media (max-width: 760px) {
    .row { grid-template-columns: 1fr; }
    .tree-btn { padding-left: 52px; padding-right: 52px; }
    table.admin thead { display: none; }
    table.admin tr { display: block; padding: 8px 10px; border-bottom: 1px solid var(--border); }
    table.admin td { display: block; border: 0; padding: 3px 0; text-align: left; }
    table.admin td.actions { text-align: left; }
    table.admin td.num { width: auto; text-align: left; }
    table.admin td.num::before { content: "Cliques: "; color: var(--muted); }
    table.admin td.url span { max-width: 100%; }
    table.admin tr.child td:nth-child(2) { padding-left: 18px; }
    table.admin tr.child td:nth-child(2)::before { left: 2px; }
}
