/* ==========================================================================
   NYVU · design system do painel
   Tema escuro. Azul = ação/navegação; verde e vermelho só pra resultado
   (lucro, status). Os nomes antigos de variáveis e classes continuam
   valendo — as páginas e o cadastro com a cor do líder dependem deles.
   ========================================================================== */

:root {
    color-scheme: dark;

    /* Marca — cadastro.php troca --blue/--blue-dark pela cor do líder */
    --blue: #2E8BFF;
    --blue-dark: #1B6FE3;
    --cyan: #3CC4EE;
    --green: #22C98B;
    --red: #F4577A;
    --amber: #F2B33D;

    /* Superfícies */
    --bg: #070B12;
    --bg-card: #0D131C;
    --bg-card-alt: #121A26;
    --bg-elevated: #172131;
    --border: #1C2634;
    --border-strong: #2A3749;

    /* Texto */
    --text: #E6ECF4;
    --text-soft: #C3CCDA;
    --text-muted: #93A0B3;
    --text-faint: #66738A;

    /* Nomes antigos */
    --silver: var(--text);
    --silver-dark: var(--text-muted);

    /* Tons suaves (fundos de ícone, pílulas, alertas) */
    --primary-soft: color-mix(in srgb, var(--blue) 15%, transparent);
    --primary-line: color-mix(in srgb, var(--blue) 35%, transparent);
    --primary-text: color-mix(in srgb, var(--blue) 65%, #ffffff);
    --green-soft: rgba(34, 201, 139, .13);
    --red-soft: rgba(244, 87, 122, .13);
    --cyan-soft: rgba(60, 196, 238, .13);
    --amber-soft: rgba(242, 179, 61, .13);
    --neutral-soft: rgba(147, 160, 179, .12);

    --radius-sm: 8px;
    --radius: 10px;
    --radius-lg: 16px;
    --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 14px 34px -20px rgba(0, 0, 0, .85);
    --ring: 0 0 0 3px color-mix(in srgb, var(--blue) 30%, transparent);

    --font: 'Plus Jakarta Sans', 'Segoe UI', Roboto, Arial, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(1100px 480px at 8% -8%, rgba(46, 139, 255, .09), transparent 60%),
        radial-gradient(900px 420px at 100% -6%, rgba(60, 196, 238, .05), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection { background: color-mix(in srgb, var(--blue) 40%, transparent); color: #fff; }

a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

h1, h2, h3 { margin-top: 0; color: var(--text); }
h1 {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.2;
    margin-bottom: 8px;
    text-wrap: balance;
}
h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16.5px;
    font-weight: 700;
    letter-spacing: -.01em;
    line-height: 1.3;
    margin-bottom: 16px;
    text-wrap: balance;
}
h2 .ico { width: 18px; height: 18px; color: var(--blue); flex-shrink: 0; }
h3 { display: flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 700; margin-bottom: 10px; }
h3 .ico { color: var(--blue); }
p { margin: 0 0 12px; }
b, strong { font-weight: 700; }
ul { padding-left: 20px; }
li { margin-bottom: 6px; }
hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

code {
    font-family: var(--mono);
    font-size: .88em;
    background: var(--bg-card-alt);
    border: 1px solid var(--border);
    padding: 1px 6px;
    border-radius: 6px;
    color: #BCD2F3;
    word-break: break-all;
}

.ico { width: 16px; height: 16px; flex-shrink: 0; display: inline-block; vertical-align: middle; }

/* ---------- utilitários ---------- */

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.green { color: var(--green); }
.red { color: var(--red); }
.blue { color: var(--primary-text); }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.stack-sm > * + * { margin-top: 8px; }

/* ---------- topo e navegação ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 10px 28px;
    min-height: 64px;
    background: rgba(7, 11, 18, .8);
    -webkit-backdrop-filter: saturate(150%) blur(14px);
    backdrop-filter: saturate(150%) blur(14px);
    border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand-logo { height: 34px; width: auto; display: block; }

.nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
}
.nav a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 12px;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
    transition: color .15s, background .15s, box-shadow .15s;
}
.nav a .ico { width: 17px; height: 17px; }
.nav a:hover { color: var(--text); background: var(--bg-card-alt); text-decoration: none; }
.nav a.active {
    color: var(--text);
    background: var(--primary-soft);
    box-shadow: inset 0 0 0 1px var(--primary-line);
}
.nav a.active .ico { color: var(--blue); }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    flex-shrink: 0;
}
.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 14px 4px 4px;
    border-radius: 999px;
    background: var(--bg-card-alt);
    border: 1px solid var(--border);
}
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--blue), var(--cyan));
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .02em;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; gap: 3px; }
.user-meta .nome {
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    padding: 1px 7px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    background: var(--neutral-soft);
    color: var(--text-muted);
}
.badge.admin { background: var(--red-soft); color: #FF93AB; }
.badge.lider { background: var(--green-soft); color: var(--green); }
.badge.aluno { background: var(--primary-soft); color: var(--primary-text); }
.badge.avulso { background: var(--amber-soft); color: var(--amber); }

/* ---------- botões ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    background: var(--blue);
    color: #fff;
    font: 600 13.5px/1 var(--font);
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .14) inset, 0 8px 18px -10px color-mix(in srgb, var(--blue) 80%, transparent);
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .06s;
}
.btn:hover { background: var(--blue-dark); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn .ico { width: 16px; height: 16px; }

.btn.secondary {
    background: var(--bg-card-alt);
    border-color: var(--border-strong);
    color: var(--text);
    box-shadow: none;
}
.btn.secondary:hover { background: var(--bg-elevated); border-color: #3A4A61; }

.btn.danger {
    background: var(--red-soft);
    border-color: rgba(244, 87, 122, .38);
    color: #FF9CB2;
    box-shadow: none;
}
.btn.danger:hover { background: rgba(244, 87, 122, .22); color: #FFC2CF; }

.btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: var(--radius-sm); }
.btn.xs { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 7px; gap: 6px; }
.btn.xs .ico { width: 14px; height: 14px; }
.btn.block { width: 100%; }
.btn.icon-only { width: 36px; padding: 0; }
.btn.google { background: #fff; color: #1F2733; border-color: #fff; box-shadow: none; }
.btn.google:hover { background: #E9EEF5; }
.btn.google .ico { width: 18px; height: 18px; }

.form-actions { margin-top: 20px; }

/* ---------- layout ---------- */

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 28px 16px;
}
.container.narrow { max-width: 880px; }

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px 24px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.page-head h1 { margin: 0; }
.page-sub {
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: 14px;
    max-width: 760px;
}
.page-sub b { color: var(--text); font-weight: 600; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
}
.back-link:hover { color: var(--text); text-decoration: none; }

.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.split { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; }

.section { margin-top: 22px; }

/* ---------- cards ---------- */

.card {
    min-width: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, .018), transparent 42%), var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow);
    overflow-x: auto;   /* tabela larga rola dentro do card no celular */
}
.card.narrow { max-width: 560px; margin: 16px auto; }
.card.alerta-borda { border-color: rgba(244, 87, 122, .45); }
.card-desc { color: var(--text-muted); font-size: 13px; margin: -8px 0 18px; }
.card-desc b { color: var(--text); }
.card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.card-head h2 { margin-bottom: 4px; }
.card-foot { color: var(--text-muted); font-size: 12.5px; margin: 14px 0 0; }

/* Cards de métrica: ícone no canto, rótulo, número grande.
   A cor do ícone segue a do número (.value.blue/.green/.red). */
.stat-card { position: relative; display: flex; flex-direction: column; padding: 18px 20px 20px; overflow: hidden; }
.stat-card .label {
    color: var(--text-muted);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    padding-right: 48px;
    line-height: 1.4;
}
.stat-card .value {
    margin-top: auto;      /* número sempre na base: alinha na linha mesmo se o rótulo quebrar */
    padding-top: 12px;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.15;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}
.stat-card .value.green { color: var(--green); }
.stat-card .value.red { color: var(--red); }
.stat-card .value.blue { color: var(--primary-text); }
.stat-card .value.amber { color: var(--amber); }
.stat-card:has(.value.amber) .stat-icon { background: var(--amber-soft); color: var(--amber); }
.stat-card .value.md { font-size: 20px; }
.stat-card .value.sm { font-size: 16px; letter-spacing: -.01em; }
.stat-icon {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: var(--neutral-soft);
    color: var(--text-muted);
}
.stat-icon .ico { width: 19px; height: 19px; }
.stat-card:has(.value.blue) .stat-icon { background: var(--primary-soft); color: var(--blue); }
.stat-card:has(.value.green) .stat-icon { background: var(--green-soft); color: var(--green); }
.stat-card:has(.value.red) .stat-icon { background: var(--red-soft); color: var(--red); }
.stat-card:has(.value.green)::after,
.stat-card:has(.value.red)::after,
.stat-card:has(.value.blue)::after {
    content: "";
    position: absolute;
    inset: auto -30% -60% auto;
    width: 70%;
    height: 90%;
    background: radial-gradient(closest-side, currentColor, transparent);
    opacity: .06;
    pointer-events: none;
}
.stat-card:has(.value.green)::after { color: var(--green); }
.stat-card:has(.value.red)::after { color: var(--red); }
.stat-card:has(.value.blue)::after { color: var(--blue); }

/* métrica dentro de outro card (assinatura, faturamento) */
.stat-card.inset { background: var(--bg-card-alt); box-shadow: none; padding: 14px 16px 16px; border-radius: 12px; }
.stat-card.inset .value { font-size: 18px; padding-top: 8px; }
.stat-card.inset .stat-icon { width: 30px; height: 30px; border-radius: 9px; top: 12px; right: 12px; }
.stat-card.inset .stat-icon .ico { width: 15px; height: 15px; }
.stat-card.inset .label { padding-right: 38px; }

/* ---------- tabelas ---------- */

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13.5px;
    font-variant-numeric: tabular-nums;
}
th, td {
    padding: 12px 14px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
}
thead th {
    background: var(--bg-card-alt);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    white-space: nowrap;
    border-bottom-color: var(--border-strong);
}
thead th:first-child { border-top-left-radius: 10px; }
thead th:last-child { border-top-right-radius: 10px; }
tbody tr:nth-child(even) td { background: rgba(255, 255, 255, .016); }
tbody tr:hover td { background: rgba(46, 139, 255, .055); }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: none; }
td { color: var(--text-soft); }
td:first-child { color: var(--text); }
td code { white-space: nowrap; word-break: normal; }
.cell-sub { display: block; color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.cell-mono { font-family: var(--mono); font-size: 12.5px; }
td.empty { color: var(--text-muted); text-align: center; padding: 30px 14px; }
td.acoes { text-align: right; white-space: nowrap; }

/* tabela chave/valor (status da conta) */
table.kv th {
    width: 220px;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}
table.kv tbody tr:nth-child(even) td, table.kv tbody tr:nth-child(even) th { background: transparent; }

/* ---------- pílulas de status ---------- */

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 3px 10px 3px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    text-transform: capitalize;
    background: var(--neutral-soft);
    color: var(--text-muted);
    vertical-align: middle;
}
.status-pill::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 22%, transparent);
}
.status-pill.aberta { background: var(--primary-soft); color: var(--primary-text); }
.status-pill.fechada,
.status-pill.ativo,
.status-pill.pago,
.status-pill.confirmado { background: var(--green-soft); color: var(--green); }
.status-pill.inativo,
.status-pill.atrasado { background: var(--red-soft); color: #FF8BA5; }
.status-pill.pendente { background: var(--amber-soft); color: var(--amber); }
.status-pill.info { background: var(--cyan-soft); color: var(--cyan); }
.status-pill.fechando { background: rgba(244, 87, 122, .1); color: #FF9DB3; }
.status-pill.cancelado { background: var(--neutral-soft); color: var(--text-muted); }
.status-pill.nao_executada { background: rgba(244, 87, 122, .1); color: #FF9DB3; }

/* barra de ocupação (VPS) */
.barra { height: 6px; border-radius: 999px; background: var(--bg-elevated); overflow: hidden; margin-top: 6px; }
.barra span { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.barra span.quase { background: var(--amber); }
.barra span.cheia { background: var(--red); }

/* status de conexão da conta (painel do aluno/avulso) */
.conexao {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 16px;
    border-radius: 12px;
    background: var(--bg-card-alt);
    border: 1px solid var(--border);
    margin-bottom: 6px;
}
.conexao .ponto {
    flex-shrink: 0;
    width: 12px;
    height: 12px;
    margin-top: 5px;
    border-radius: 50%;
    background: var(--text-faint);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--text-faint) 20%, transparent);
}
.conexao.ok .ponto { background: var(--green); box-shadow: 0 0 0 5px var(--green-soft); }
.conexao.alerta .ponto { background: var(--amber); box-shadow: 0 0 0 5px var(--amber-soft); }
.conexao.erro .ponto { background: var(--red); box-shadow: 0 0 0 5px var(--red-soft); }
.conexao .titulo { font-weight: 700; font-size: 15px; color: var(--text); }
.conexao .detalhe { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

.lucro.pos { color: var(--green); font-weight: 700; }
.lucro.neg { color: var(--red); font-weight: 700; }

/* ---------- formulários ---------- */

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-soft);
    margin: 16px 0 7px;
}
label .hint, .hint { color: var(--text-faint); font-weight: 500; }

input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]):not([type="hidden"]),
select,
textarea {
    width: 100%;
    height: 42px;
    padding: 0 13px;
    border-radius: var(--radius);
    border: 1px solid var(--border-strong);
    background: var(--bg-card-alt);
    color: var(--text);
    font: 500 14px var(--font);
    transition: border-color .15s, box-shadow .15s, background .15s;
}
input[type="number"] { font-variant-numeric: tabular-nums; }
textarea {
    height: auto;
    min-height: 92px;
    padding: 11px 13px;
    resize: vertical;
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.55;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:hover, select:hover, textarea:hover { border-color: #36455B; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: var(--ring);
    background: #0F1723;
}
select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 38px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2393A0B3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}
select option { background: var(--bg-card-alt); color: var(--text); }

input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin: 0;
    border-radius: 5px;
    border: 1.5px solid #3C4C63;
    background: var(--bg-card-alt);
    display: inline-grid;
    place-content: center;
    cursor: pointer;
    transition: background .15s, border-color .15s, box-shadow .15s;
}
input[type="checkbox"]::before {
    content: "";
    width: 10px;
    height: 10px;
    background: #fff;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
    transform: scale(0);
    transition: transform .12s ease-in-out;
}
input[type="checkbox"]:checked { background: var(--blue); border-color: var(--blue); }
input[type="checkbox"]:checked::before { transform: scale(1); }
input[type="checkbox"]:focus-visible { outline: none; box-shadow: var(--ring); }

input[type="color"] {
    width: 64px;
    height: 42px;
    padding: 4px;
    border-radius: var(--radius);
    border: 1px solid var(--border-strong);
    background: var(--bg-card-alt);
    cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 6px; }

input[type="file"] {
    width: 100%;
    height: 42px;
    padding: 5px;
    border-radius: var(--radius);
    border: 1px dashed var(--border-strong);
    background: var(--bg-card-alt);
    color: var(--text-muted);
    font: 500 13px var(--font);
    cursor: pointer;
}
input[type="file"]::file-selector-button {
    height: 30px;
    margin-right: 10px;
    padding: 0 12px;
    border-radius: 7px;
    border: 1px solid var(--border-strong);
    background: var(--bg-elevated);
    color: var(--text);
    font: 600 12.5px var(--font);
    cursor: pointer;
}

/* checkbox com texto ao lado */
label.check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 18px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    cursor: pointer;
}
label.check input { margin-top: 1px; }

/* campos lado a lado, botão alinhado embaixo */
.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-row .field { flex: 1 1 160px; min-width: 0; }
.form-row .field.grow { flex: 2 1 220px; }
.form-row .field.auto { flex: 0 0 auto; }
.form-row label { margin-top: 0; }
.form-row + .form-row { margin-top: 12px; }

/* campo do cartão (iframe do Mercado Pago) */
.mp-field {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border-strong);
    background: var(--bg-card-alt);
}
.mp-field.focused { border-color: var(--blue); box-shadow: var(--ring); }
.form-erro { color: var(--red); font-size: 12.5px; margin-top: 8px; min-height: 1em; }

/* ---------- alertas ---------- */

.alert {
    position: relative;
    padding: 12px 14px 12px 42px;
    border-radius: 12px;
    border: 1px solid;
    font-size: 13.5px;
    line-height: 1.55;
    margin-bottom: 16px;
}
.alert::before {
    content: "";
    position: absolute;
    left: 14px;
    top: 13px;
    width: 18px;
    height: 18px;
    background-color: currentColor;
    -webkit-mask: var(--alert-ico) center / contain no-repeat;
    mask: var(--alert-ico) center / contain no-repeat;
}
.alert.error {
    background: rgba(244, 87, 122, .08);
    border-color: rgba(244, 87, 122, .32);
    color: #FFA2B6;
    --alert-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'/%3E%3C/svg%3E");
}
.alert.success {
    background: rgba(34, 201, 139, .08);
    border-color: rgba(34, 201, 139, .32);
    color: #86E6C0;
    --alert-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 11.08V12a10 10 0 1 1-5.93-9.14'/%3E%3Cpolyline points='22 4 12 14.01 9 11.01'/%3E%3C/svg%3E");
}
.alert.info {
    background: rgba(60, 196, 238, .07);
    border-color: rgba(60, 196, 238, .3);
    color: #9EDFF5;
    --alert-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='16' x2='12' y2='12'/%3E%3Cline x1='12' y1='8' x2='12.01' y2='8'/%3E%3C/svg%3E");
}
.alert b { color: inherit; }
.alert a { color: inherit; text-decoration: underline; }
.alert > :last-child { margin-bottom: 0; }

/* ---------- caixas de código / link ---------- */

.ref-link-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border-strong);
    background: var(--bg-card-alt);
    color: var(--cyan);
    font: 500 12.5px/1.5 var(--mono);
    word-break: break-all;
}
.ref-link-box .ico { color: var(--text-muted); }
.ref-link-box.plain { font: 500 13.5px/1.5 var(--font); color: var(--text-soft); word-break: normal; }

/* ---------- blocos recolhíveis ---------- */

details {
    margin-top: 14px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-card-alt);
}
details > summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 0;
    list-style: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 600;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
    content: "";
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform .15s;
    margin: 0 2px;
}
details[open] > summary { color: var(--text); }
details[open] > summary::before { transform: rotate(45deg); }
details > summary:hover { color: var(--text); }
.details-body { padding-bottom: 16px; }

/* ---------- passos numerados (área de teste) ---------- */

.step {
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: var(--primary-soft);
    color: var(--primary-text);
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
}

/* ---------- telas de acesso (login, cadastro, aceite) ---------- */

.login-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 16px;
}
.login-box {
    position: relative;
    width: 100%;
    max-width: 400px;
    padding: 36px 34px 32px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255, 255, 255, .02), transparent 30%), var(--bg-card);
    box-shadow: 0 40px 90px -50px color-mix(in srgb, var(--blue) 55%, transparent), var(--shadow);
}
.login-box::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 18%;
    right: 18%;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, var(--blue), var(--cyan), transparent);
}
.login-box.wide { max-width: 460px; }
.login-box.wider { max-width: 500px; }
.login-box .logo { text-align: center; font-size: 26px; font-weight: 800; margin-bottom: 4px; }
.login-logo { display: block; margin: 0 auto 10px; max-height: 84px; width: auto; }
.login-box .sub {
    text-align: center;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .16em;
    margin-bottom: 22px;
}
.login-intro { text-align: center; color: var(--text-muted); font-size: 13.5px; margin: -8px 0 22px; }
.login-intro b { color: var(--text); }
.login-foot { text-align: center; color: var(--text-muted); font-size: 13px; margin: 18px 0 0; }
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0 4px;
    color: var(--text-faint);
    font-size: 12px;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.demo-users {
    margin-top: 22px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px dashed var(--border-strong);
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.7;
}
.demo-users b { color: var(--text); }

/* ---------- texto longo (termos) ---------- */

.prose { font-size: 14.5px; line-height: 1.75; color: var(--text-soft); }
.prose h2 { margin: 30px 0 10px; font-size: 16px; }
.prose > h2:first-child { margin-top: 0; }
.prose b { color: var(--text); }
.prose .alert { font-size: 14.5px; line-height: 1.75; padding: 18px 20px 18px 48px; margin: 24px 0; }
.prose .alert::before { left: 18px; top: 21px; }
.prose .alert h2 { margin-top: 0; color: inherit; }

/* ---------- rodapé ---------- */

.footer-note {
    margin-top: auto;
    padding: 36px 16px 28px;
    text-align: center;
    color: var(--text-faint);
    font-size: 12px;
}
.footer-note a { color: var(--text-muted); }

/* ---------- responsivo ---------- */

@media (max-width: 1080px) {
    .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid.split { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
    .topbar { flex-wrap: wrap; gap: 10px 14px; padding: 10px 16px 0; }
    .nav {
        order: 3;
        flex-basis: 100%;
        overflow-x: auto;
        padding-bottom: 10px;
        scrollbar-width: none;
    }
    .nav::-webkit-scrollbar { display: none; }
    .container { padding: 24px 16px 12px; }
}

@media (max-width: 720px) {
    .grid.cols-2, .grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
    h1 { font-size: 22px; }
    .card { padding: 18px 16px; }
    table:not(.kv) { min-width: 620px; }
    .page-head { align-items: flex-start; }
    .login-box { padding: 30px 22px 26px; }
    table.kv th { width: 140px; }
}

@media (max-width: 520px) {
    .grid.cols-4 { gap: 12px; }
    .user-meta { display: none; }
    .user-chip { padding: 3px; }
    /* métricas em 2 colunas, compactas */
    .grid.cols-4 .stat-card { padding: 14px 14px 16px; }
    .grid.cols-4 .stat-card .label { font-size: 10.5px; padding-right: 34px; }
    .grid.cols-4 .stat-card .value { font-size: 20px; }
    .grid.cols-4 .stat-card .stat-icon { width: 28px; height: 28px; border-radius: 8px; top: 12px; right: 12px; }
    .grid.cols-4 .stat-card .stat-icon .ico { width: 15px; height: 15px; }
}

@media (max-width: 340px) {
    .grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
}

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