/* =====================================================================
   Fontes — auto-hospedadas (sem CDN, sem request externo em runtime).
   Variáveis, subset latin (cobre acentos do PT). Servidas de /assets/fonts.
     · Geist              → corpo/UI
     · Geist Mono         → valores financeiros (.mono)
     · Bricolage Grotesque→ títulos, marca e destaques (display)
   ===================================================================== */
@font-face {
    font-family: 'Geist';
    src: url('/assets/fonts/geist.woff2') format('woff2');
    font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Geist Mono';
    src: url('/assets/fonts/geist-mono.woff2') format('woff2');
    font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Bricolage Grotesque';
    src: url('/assets/fonts/bricolage.woff2') format('woff2');
    font-weight: 200 800; font-style: normal; font-display: swap;
}

/* =====================================================================
   MegaInvest — folha de estilo única.

   Design system "navy sobre branco", pegada Asaas/Stripe: traço fino,
   pesos de fonte leves, fios de 1px, superfícies claras. Sem CDN — tudo
   local (o MVP dependia de Bootstrap e Google Fonts remotos).

   Tokens em três camadas:
     1. primitivos  → a rampa de cor bruta
     2. semânticos  → o papel que cada cor cumpre (surface, text, brand…)
     3. componente  → cada peça usa só os semânticos
   As views referenciam sempre os semânticos, nunca um hex.
   ===================================================================== */

:root {
    /* 1. PRIMITIVOS ------------------------------------------------ */
    --navy-900:#0A2540; --navy-700:#1B3A5C; --navy-500:#3E4B5B;
    --slate-500:#647087; --slate-400:#8B95A6; --slate-300:#AEB7C4;
    --blue-600:#123CCB; --blue-500:#1B54FF; --blue-50:#EEF2FF;
    --green-600:#0E9F6E; --green-50:#E7F6F0;
    --amber-600:#B25A00; --amber-500:#D97706; --amber-50:#FBF1E2;
    --red-600:#DF1B41; --red-50:#FCEBEF;
    --info-600:#0B69C7; --info-50:#E7F1FC;
    --violet-500:#7C5CFF;
    --white:#FFFFFF; --canvas:#F7F9FC;
    --gray-100:#F4F6FA; --gray-200:#EDF1F5; --gray-300:#E1E7EF; --gray-350:#E7EBF1;

    /* 2. SEMÂNTICOS ----------------------------------------------- */
    --brand: var(--blue-500);
    --brand-strong: var(--blue-600);
    --brand-soft: var(--blue-50);

    --bg: var(--canvas);
    --surface: var(--white);
    --surface-2: var(--gray-100);   /* recesso sutil: th de tabela, input, radio, árvore */
    --surface-3: var(--gray-350);   /* trilho de progresso, badge neutro, barra de distribuição */
    --border: var(--gray-200);
    --border-strong: var(--gray-300);

    --text: var(--navy-900);
    --text-muted: var(--slate-500);
    --text-faint: var(--slate-400);

    --success: var(--green-600);      --success-soft: var(--green-50);
    --warning: var(--amber-600);      --warning-soft: var(--amber-50);
    --danger:  var(--red-600);        --danger-soft:  var(--red-50);
    --info:    var(--info-600);       --info-soft:    var(--info-50);
    --violet:  var(--violet-500);
    --amber:   var(--amber-500);

    /* categóricas dos gráficos (validadas p/ daltonismo) */
    --cat-1: var(--blue-500);
    --cat-2: var(--green-600);
    --cat-3: var(--violet-500);
    --cat-4: var(--amber-500);

    /* Espaçamento */
    --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
    --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;

    --radius:    10px;
    --radius-lg: 14px;
    --radius-pill: 999px;

    --shadow:    0 1px 1px rgba(10,37,64,.04), 0 1px 3px rgba(10,37,64,.05);
    --shadow-lg: 0 4px 12px rgba(10,37,64,.08), 0 18px 40px rgba(10,37,64,.10);

    --font: 'Geist', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
            "Helvetica Neue", Arial, sans-serif;
    --mono: 'Geist Mono', ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
    --font-display: 'Bricolage Grotesque', 'Geist', -apple-system, sans-serif;

    --sidebar-w: 248px;
    --header-h: 60px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: hidden; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    letter-spacing: -.005em;
    -webkit-font-smoothing: antialiased;
}

/* Fonte de display (Bricolage Grotesque) nos títulos, marca e destaques.
   É o "wow" da identidade — o corpo/tabelas seguem em Geist. */
.page-title, .card__title, .sidebar__brand, .auth__word, .auth__pitch,
.auth__head h1, .empty__title {
    font-family: var(--font-display);
    letter-spacing: -.02em;
    font-weight: 600;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 var(--sp-3); line-height: 1.25; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p  { margin: 0 0 var(--sp-3); }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* ícones: SVG de traço fino que herda a cor do texto */
.ico { width: 18px; height: 18px; flex: none; display: inline-block; }
.ico svg, .nav-item__icon svg, .tabbar__icon svg {
    width: 100%; height: 100%; display: block;
    stroke: currentColor; stroke-width: 1.5; fill: none;
    stroke-linecap: round; stroke-linejoin: round;
}

/* ------------------------------------------------------------- estrutura */

.layout { min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    position: fixed; left: 0; top: 0;
    padding: 20px 12px;
    z-index: 40;
    display: flex; flex-direction: column;
    overflow-y: auto;
}
.sidebar .logo, .sidebar__brand {
    display: flex; align-items: center; gap: var(--sp-2);
    font-size: .98rem; font-weight: 600;
    margin-bottom: 20px; padding: 4px 10px;
    color: var(--text);
}
.sidebar__mark {
    width: 27px; height: 27px; border-radius: 7px;
    background: var(--brand); color: #fff;
    display: grid; place-items: center;
    font-size: .72rem; font-weight: 700; flex: none;
}

.sidebar a, .sidebar summary, .sidebar button.nav-item {
    display: flex; align-items: center; gap: 11px;
    width: 100%;
    color: var(--text-muted);
    background: none;
    text-decoration: none !important;
    padding: 8px 11px;
    border: 0; border-radius: 8px;
    margin-bottom: 1px;
    font-family: inherit; font-size: .875rem; font-weight: 450;
    text-align: left;
    cursor: pointer; list-style: none;
    transition: background .12s, color .12s;
}
.sidebar a:hover, .sidebar summary:hover, .sidebar button.nav-item:hover { background: var(--surface-2); color: var(--text); }
.sidebar a.active, .sidebar a.active-sub,
.sidebar a.nav-item--active { background: var(--brand-soft); color: var(--brand) !important; font-weight: 550; }
.sidebar hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-3) 0; }

.sidebar__section {
    font-size: .64rem; text-transform: uppercase; letter-spacing: .09em;
    color: var(--text-faint); font-weight: 600;
    padding: 15px 10px 5px;
}
.nav-item__icon { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav-item__badge {
    margin-left: auto; background: var(--danger); color: #fff;
    font-size: .66rem; font-weight: 700; padding: 1px 7px; border-radius: var(--radius-pill);
}

/* submenus do layout legado (details/summary) */
.submenu { padding-left: 8px; margin-bottom: 4px; }
.submenu a { padding: 7px 11px; font-size: .84rem; }

.main { margin-left: var(--sidebar-w); min-width: 0; }
.content { padding: 26px 32px; max-width: 1240px; margin: 0 auto; }

.topbar {
    height: var(--header-h);
    background: rgba(255,255,255,.82);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 28px;
    position: sticky; top: 0; z-index: 30;
}
.topbar__title { font-weight: 550; font-size: .95rem; }
.topbar__user { display: flex; align-items: center; gap: 11px; }

.badge-role {
    font-size: .68rem; padding: 4px 9px; border-radius: var(--radius-pill);
    text-transform: uppercase; letter-spacing: .04em;
    background: var(--brand-soft); color: var(--brand); font-weight: 600;
}

.avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--navy-900); color: #fff;
    display: grid; place-items: center; font-weight: 600; font-size: .76rem; flex: none;
}
.avatar--sm { width: 27px; height: 27px; font-size: .68rem; }
.table__user { display: flex; align-items: center; gap: 9px; }

/* área de conteúdo interna (o <main> das telas) */
main { display: block; }
.page-wrap, main > * { }
.container-inner { padding: 26px 32px; max-width: 1240px; margin: 0 auto; width: 100%; }

/* ------------------------------------------------------------- cartões */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-5);
    box-shadow: var(--shadow);
    min-width: 0;
}
.card + .card { margin-top: var(--sp-4); }
.card__header {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--sp-3); margin-bottom: var(--sp-4);
}
.card__title { font-weight: 550; font-size: 1rem; margin: 0; }
.card__hint  { color: var(--text-muted); font-size: .84rem; margin: 0; }

.grid { display: grid; gap: var(--sp-4); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid > * { min-width: 0; }

/* --------------------------------------------------------------- métrica */

.metric {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    box-shadow: var(--shadow);
}
.metric__label {
    font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--text-muted); font-weight: 550; margin-bottom: 8px;
}
.metric__value { font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; }
.metric__value--sm { font-size: 1.2rem; }
.metric__foot { font-size: .78rem; color: var(--text-faint); margin-top: 4px; }
.metric--brand   { background: linear-gradient(165deg,#F4F7FF,#FFFFFF); border-color: #DDE6FF; }
.metric--success { border-color: #C7EBDC; }
.metric--warning { border-color: #F1DDB8; }

.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger  { color: var(--danger); }
.text-muted   { color: var(--text-muted); }
.text-faint   { color: var(--text-faint); }
.mono         { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: 0; }

/* variação de tendência (▲/▼) sob a métrica */
.kdelta { font-size: .74rem; font-weight: 600; margin-top: 5px; display: inline-flex; align-items: center; gap: 4px; }
.kdelta.up { color: var(--success); }
.kdelta.flat { color: var(--text-faint); }

/* --------------------------------------------------------------- selos */

.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 9px; border-radius: var(--radius-pill);
    font-size: .7rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .03em; white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--warning { background: var(--warning-soft); color: var(--warning); }
.badge--danger  { background: var(--danger-soft);  color: var(--danger); }
.badge--info    { background: var(--info-soft);    color: var(--info); }
.badge--neutral { background: var(--surface-3);    color: var(--text-muted); }

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

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    -webkit-overflow-scrolling: touch;
}
.table { width: 100%; border-collapse: collapse; font-size: .86rem; min-width: 560px; }
.table th {
    text-align: left; padding: 11px var(--sp-4);
    background: var(--surface-2); color: var(--text-faint);
    font-size: .68rem; text-transform: uppercase; letter-spacing: .05em;
    font-weight: 550; white-space: nowrap; border-bottom: 1px solid var(--border);
}
.table td { padding: 12px var(--sp-4); border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table__num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }

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

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px var(--sp-4);
    border: 1px solid transparent; border-radius: 9px;
    font-family: inherit; font-size: .85rem; font-weight: 550;
    cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover { text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--brand-strong); }
.btn--success { background: var(--success); color: #fff; }
.btn--danger  { background: var(--danger); color: #fff; }
.btn--ghost   { background: var(--surface); color: var(--text-muted); border-color: var(--border-strong); }
.btn--ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn--sm { padding: 6px 11px; font-size: .79rem; }
.btn--block { width: 100%; }
/* botão suave: ação secundária num fundo claro */
.btn--soft { background: var(--brand-soft); color: var(--brand); }
.btn--soft:hover:not(:disabled) { background: #E2E9FF; }

/* ------------------------------------------------------------ formulário */

.field { margin-bottom: var(--sp-4); }
.label {
    display: block; font-size: .74rem; font-weight: 600;
    color: var(--text-muted); margin-bottom: var(--sp-2);
    text-transform: uppercase; letter-spacing: .04em;
}
.input, .select, .textarea {
    width: 100%; padding: 10px var(--sp-4);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 9px; color: var(--text);
    font-family: inherit; font-size: .92rem;
}
.input:focus, .select:focus, .textarea:focus {
    border-color: var(--brand); outline: none;
    box-shadow: 0 0 0 3px var(--brand-soft);
}
.input::placeholder { color: var(--text-faint); }
.textarea { min-height: 120px; resize: vertical; }
.hint { font-size: .78rem; color: var(--text-faint); margin-top: var(--sp-2); }
.hint--error { color: var(--danger); }

.radio-card {
    display: flex; align-items: flex-start; gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 10px; cursor: pointer; margin-bottom: var(--sp-2);
}
.radio-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.radio-card input { margin-top: 3px; accent-color: var(--brand); }

/* --------------------------------------------------------------- avisos */

.alert {
    display: flex; align-items: flex-start; gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius); border: 1px solid;
    margin-bottom: var(--sp-4); font-size: .88rem;
}
.alert--success { background: var(--success-soft); border-color: #BFE7D5; color: #0A7A54; }
.alert--warning { background: var(--warning-soft); border-color: #F1D9B0; color: #8A4A00; }
.alert--danger  { background: var(--danger-soft);  border-color: #F3C6D0; color: #B01530; }
.alert--info    { background: var(--info-soft);    border-color: #CDE3F8; color: #0B69C7; }

/* ------------------------------------------------------------- progresso */

.progress { height: 6px; background: var(--surface-3); border-radius: var(--radius-pill); overflow: hidden; }
.progress__bar {
    height: 100%;
    background: linear-gradient(90deg, var(--brand), var(--violet));
    border-radius: var(--radius-pill); transition: width .6s ease;
}
.progress__bar--success { background: linear-gradient(90deg, var(--success), #16a34a); }

/* ------------------------------------------------------- estado vazio */

.empty { text-align: center; padding: var(--sp-7) var(--sp-4); color: var(--text-muted); }
.empty__icon { font-size: 2rem; opacity: .45; margin-bottom: var(--sp-3); color: var(--text-faint); }
.empty__title { font-weight: 600; color: var(--text); margin-bottom: var(--sp-2); }
.empty__text { font-size: .88rem; max-width: 42ch; margin: 0 auto var(--sp-4); }

/* ------------------------------------------------------------ esqueleto */

.skeleton {
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
    background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 6px;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* --------------------------------------------------------------- árvore */

.tree { --tree-elbow: 20px; }
.tree__list { list-style: none; margin: 0; padding: 0; }
.tree .avatar { background: var(--av, var(--navy-900)); }

/* ramos aninhados: linha vertical + cotovelo em cada nó */
.tree__children > .tree__list { margin-left: 15px; padding-left: 22px; position: relative; }
.tree__li { position: relative; }
.tree__children > .tree__list > .tree__li::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0;
    border-left: 1px solid var(--border-strong);
}
.tree__children > .tree__list > .tree__li:last-child::before { bottom: auto; height: 28px; }
.tree__children > .tree__list > .tree__li::after {
    content: ''; position: absolute; left: 0; top: 28px; width: 22px;
    border-top: 1px solid var(--border-strong);
}

.tree__node {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px; margin: 5px 0;
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: 11px;
    transition: border-color .12s, box-shadow .12s;
}
.tree__node:hover { border-color: #D6E0FF; box-shadow: 0 1px 3px rgba(10,37,64,.05); }
.tree__toggle {
    width: 22px; height: 22px; flex: none; border: 0; background: none; padding: 0;
    display: grid; place-items: center; border-radius: 6px; color: var(--text-faint); cursor: pointer;
    transition: background .12s, transform .15s;
}
.tree__toggle svg { width: 16px; height: 16px; }
.tree__toggle:hover { background: var(--surface-2); color: var(--text); }
.tree__toggle--leaf { cursor: default; }
.tree__li.is-collapsed > .tree__node .tree__toggle { transform: rotate(-90deg); }
.tree__li.is-collapsed > .tree__children { display: none; }
.tree__meta { flex: 1; min-width: 0; }
.tree__name { font-weight: 600; font-size: .9rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree__sub { display: flex; align-items: center; gap: 8px; margin-top: 2px; font-size: .74rem; color: var(--text-faint); flex-wrap: wrap; }
.tree__role { color: var(--text-muted); }
.tree__lvl { font-weight: 600; }
.tree__count { padding: 1px 7px; background: var(--surface-2); border-radius: 999px; }
.tree__prod { text-align: right; flex: none; padding-left: 8px; }
.tree__prod-l { display: block; font-size: .66rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); }
.tree__prod-v { font-size: .86rem; color: var(--text); white-space: nowrap; }
@media (max-width: 640px) {
    .tree__prod-l { display: none; }
    .tree__node { gap: 8px; padding: 8px 10px; }
}

/* ------------------------------------------------------------- conversa */

.message { padding: var(--sp-3) var(--sp-4); border-radius: var(--radius); margin-bottom: var(--sp-3); background: var(--surface-2); border: 1px solid var(--border); }
.message--staff { background: var(--brand-soft); border-color: #D6E0FF; }
.message__meta { display: flex; justify-content: space-between; gap: var(--sp-3); font-size: .75rem; color: var(--text-muted); margin-bottom: var(--sp-2); }
.message__body { white-space: pre-wrap; word-break: break-word; }

/* ---------------------------------------------------------------- login */

/* ===== Acesso (split-screen SaaS) ===== */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr; background: var(--bg); }
@media (min-width: 900px) { .auth { grid-template-columns: minmax(0, 1fr) minmax(0, 1.04fr); } }

/* coluna esquerda — formulário */
.auth__panel {
    display: flex; flex-direction: column; min-height: 100vh;
    padding: 28px 32px; background: var(--surface);
}
@media (min-width: 900px) { .auth__panel { padding: 34px 44px; } }
.auth__brandrow { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; align-self: flex-start; }
.auth__mark {
    width: 38px; height: 38px; border-radius: 11px;
    background: linear-gradient(150deg, var(--brand), var(--brand-strong));
    display: grid; place-items: center; font-weight: 700; color: #fff; font-size: .84rem; letter-spacing: .02em;
    box-shadow: 0 4px 12px rgba(27,84,255,.28);
}
.auth__word { font-weight: 650; font-size: 1.02rem; color: var(--text); letter-spacing: -.01em; }
.auth__center { flex: 1; display: flex; align-items: center; padding: 28px 0; }
.auth__form { width: 100%; max-width: 372px; margin: 0 auto; }
.auth__head { margin-bottom: var(--sp-5); }
.auth__head h1 { font-size: 1.6rem; font-weight: 650; letter-spacing: -.02em; color: var(--text); margin: 0 0 6px; }
.auth__head p { margin: 0; color: var(--text-muted); font-size: .92rem; }
.auth__foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: .78rem; color: var(--text-faint); }
.auth__foot-sec { display: inline-flex; align-items: center; gap: 6px; }
.auth__foot-sec svg { width: 15px; height: 15px; }
.auth__alt { margin: var(--sp-4) 0 0; text-align: center; font-size: .88rem; color: var(--text-muted); }
.auth__alt a { font-weight: 550; }

/* botão de mostrar/ocultar senha */
.pw { position: relative; }
.pw .input { padding-right: 42px; }
.pw__toggle {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 30px; height: 30px; border: 0; background: none; cursor: pointer;
    display: grid; place-items: center; color: var(--text-faint); border-radius: 7px;
    transition: color .12s, background .12s;
}
.pw__toggle:hover { color: var(--brand); background: var(--surface-2); }
.pw__toggle svg { width: 18px; height: 18px; }

/* coluna direita — painel de marca */
.auth__aside { display: none; position: relative; overflow: hidden; color: #fff;
    background-color: var(--navy-900);
    background-image:
        radial-gradient(760px 460px at 82% -8%, rgba(27,84,255,.42), transparent 60%),
        radial-gradient(640px 460px at 6% 112%, rgba(124,92,255,.22), transparent 58%),
        radial-gradient(circle at 1px 1px, rgba(255,255,255,.05) 1px, transparent 0);
    background-size: auto, auto, 22px 22px;
}
@media (min-width: 900px) { .auth__aside { display: flex; align-items: center; } }
.auth__aside::after { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 160px 40px rgba(10,37,64,.55); pointer-events: none; }
.auth__aside-inner { position: relative; z-index: 1; padding: 56px; max-width: 480px; }
.auth__eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .7rem; font-weight: 600; color: rgba(255,255,255,.55); margin: 0 0 18px; }
.auth__pitch { font-size: 2.05rem; line-height: 1.18; font-weight: 550; letter-spacing: -.02em; margin: 0 0 40px; color: #fff; }
.auth__trust { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 22px; }
.auth__trust li { display: flex; gap: 14px; align-items: flex-start; }
.auth__trust-ic { width: 38px; height: 38px; flex: none; border-radius: 10px; display: grid; place-items: center;
    background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); color: #9DB7FF; }
.auth__trust-ic svg { width: 19px; height: 19px; }
.auth__trust strong { display: block; font-size: .96rem; font-weight: 600; color: #fff; margin-bottom: 3px; }
.auth__trust span { font-size: .86rem; color: rgba(255,255,255,.62); line-height: 1.45; }

/* ---- refinamentos "impeccable" ---- */

/* campo com ícone à esquerda */
.ifield { position: relative; }
.ifield__ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); z-index: 1;
    display: grid; place-items: center; color: var(--text-faint); pointer-events: none; transition: color .12s; }
.ifield__ic svg { width: 17px; height: 17px; }
.ifield .input { padding-left: 38px; }
.ifield:focus-within .ifield__ic { color: var(--brand); }

/* campos e botão do login mais táteis + micro-interações */
.auth__form .input { padding-top: 11px; padding-bottom: 11px; border-radius: 10px; }
.auth__form .btn--block { padding-top: 12px; padding-bottom: 12px; font-weight: 600; gap: 8px; }
.auth__form .btn--primary {
    box-shadow: 0 6px 16px rgba(27,84,255,.24);
    transition: transform .12s ease, box-shadow .12s ease, background .12s;
}
.auth__form .btn--primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(27,84,255,.32); }
.auth__form .btn--primary:active { transform: translateY(0); box-shadow: 0 4px 12px rgba(27,84,255,.24); }
.btn__arrow { width: 17px; height: 17px; transition: transform .16s ease; }
.auth__form .btn--primary:hover .btn__arrow { transform: translateX(3px); }
.auth__brandrow { transition: opacity .15s; }
.auth__brandrow:hover { opacity: .82; }

/* entrada orquestrada (uma vez, no load) */
@keyframes authUp { from { opacity: 0; transform: translateY(11px); } to { opacity: 1; transform: none; } }
.auth__anim { opacity: 0; animation: authUp .55s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--d, 0) * 80ms + 40ms); }
@media (prefers-reduced-motion: reduce) { .auth__anim { opacity: 1; animation: none; } }

/* textura de grão no painel de marca (profundidade) */
.auth__aside::before {
    content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0; opacity: .5; mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* rodapé do painel de marca — honesto, sem dados falsos */
.auth__aside-foot { margin-top: 40px; padding-top: 22px; border-top: 1px solid rgba(255,255,255,.10);
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .8rem; color: rgba(255,255,255,.55); }
.auth__aside-foot .dotsep { width: 3px; height: 3px; border-radius: 50%; background: rgba(255,255,255,.35); flex: none; }

/* ------------------------------------------------------------- utilidades */

.stack { display: flex; flex-direction: column; gap: var(--sp-3); }
.row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.mt-4 { margin-top: var(--sp-4); } .mt-5 { margin-top: var(--sp-5); }
.mb-4 { margin-bottom: var(--sp-4); } .mb-5 { margin-bottom: var(--sp-5); }
.hide { display: none !important; }
.page-title { margin-bottom: var(--sp-2); font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; }
.page-sub { color: var(--text-muted); margin-bottom: var(--sp-5); font-size: .9rem; }

/* ---------------------------------------------------- alternador e filtros */

.viewswitch { display: inline-flex; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 9px; padding: 2px; gap: 3px; }
.viewswitch__item { padding: 6px var(--sp-4); border-radius: 7px; font-size: .82rem; font-weight: 500; color: var(--text-muted); text-decoration: none; white-space: nowrap; }
.viewswitch__item:hover { color: var(--text); text-decoration: none; }
.viewswitch__item--active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

.filterbar { display: flex; gap: var(--sp-2); overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.filterbar__item {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 7px var(--sp-3); border: 1px solid var(--border-strong); border-radius: var(--radius-pill);
    background: var(--surface); color: var(--text-muted);
    font-size: .82rem; font-weight: 550; text-decoration: none; white-space: nowrap; flex: none;
}
.filterbar__item:hover { border-color: var(--brand); color: var(--text); text-decoration: none; }
.filterbar__item--active { background: var(--brand); border-color: var(--brand); color: #fff; }
.filterbar__count { background: var(--surface-3); color: var(--text-faint); border-radius: var(--radius-pill); padding: 0 7px; font-size: .72rem; font-variant-numeric: tabular-nums; }
.filterbar__item--active .filterbar__count { background: rgba(255,255,255,.2); color: #fff; }

/* seletor segmentado + controles (barra de filtros do dashboard) */
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 9px; padding: 2px; }
.seg button, .seg a { border: 0; background: none; font: inherit; font-size: .8rem; font-weight: 500; color: var(--text-muted); padding: 5px 11px; border-radius: 7px; cursor: pointer; text-decoration: none; line-height: 1.5; }
.seg button.on, .seg a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.ctl { display: inline-flex; align-items: center; gap: 7px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 9px; padding: 6px 11px; font-size: .8rem; color: var(--text-muted); font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none; }
.ctl:hover { border-color: var(--brand); color: var(--brand); }
.ctl:hover .ico { color: var(--brand); }
.ctl .ico { width: 15px; height: 15px; color: var(--text-faint); }

/* filtro por chips (client-side) */
.chipbar { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 7px 13px; border: 1px solid var(--border-strong); border-radius: 999px;
    background: var(--surface); font: inherit; font-size: .82rem; font-weight: 500;
    color: var(--text-muted); cursor: pointer; transition: border-color .12s, color .12s, background .12s;
}
.chip:hover { border-color: var(--text-faint); color: var(--text); }
.chip.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.chip__n { font-size: .72rem; font-weight: 600; opacity: .7; }
.chip.on .chip__n { opacity: .9; }
.grid--cards > [data-st].is-hidden { display: none; }
.early-wd summary { cursor: pointer; }
.early-wd summary::-webkit-details-marker { display: none; }

/* ============================================================
   Componentes custom — nunca input nativo (regra do projeto).
   O elemento nativo fica escondido como fonte da verdade do
   formulário; o widget custom escreve de volta nele.
   ============================================================ */

/* select custom */
.cselect { position: relative; }
.cselect__native { display: none; }
.cselect__btn {
    width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 10px var(--sp-4); background: var(--surface);
    border: 1px solid var(--border-strong); border-radius: 9px;
    font: inherit; font-size: .92rem; color: var(--text); cursor: pointer; text-align: left;
    transition: border-color .12s, box-shadow .12s;
}
.cselect__btn:hover { border-color: var(--border-strong); }
.cselect.is-open .cselect__btn { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.cselect__val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cselect__chev { width: 16px; height: 16px; color: var(--text-faint); flex: none; transition: transform .15s; }
.cselect.is-open .cselect__chev { transform: rotate(180deg); }
.cselect__menu {
    position: absolute; left: 0; right: 0; top: calc(100% + 6px);
    background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: 10px; box-shadow: var(--shadow-lg);
    padding: 5px; z-index: 70; max-height: 244px; overflow-y: auto; display: none;
}
.cselect.is-open .cselect__menu { display: block; }
.cselect__menu--up { top: auto; bottom: calc(100% + 6px); }
.cselect__opt {
    padding: 9px 11px; border-radius: 7px; font-size: .9rem; color: var(--text-muted);
    cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cselect__opt:hover { background: var(--surface-2); color: var(--text); }
.cselect__opt.is-selected { background: var(--brand-soft); color: var(--brand); font-weight: 550; }
.cselect__opt.is-disabled { opacity: .4; cursor: not-allowed; }

/* date custom — input digitável (máscara DD/MM/AAAA) + ícone que abre o calendário */
.cdate { position: relative; }
.cdate__native { display: none; }
.cdate__text { padding-right: 40px; }
.cdate__text.is-invalid { border-color: var(--danger); }
.cdate__ic {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 30px; height: 30px; border: 0; background: none; cursor: pointer;
    display: grid; place-items: center; color: var(--text-faint); border-radius: 7px;
    transition: color .12s, background .12s;
}
.cdate__ic:hover { color: var(--brand); background: var(--surface-2); }
.cdate.is-open .cdate__ic { color: var(--brand); }
.cdate__ic svg { width: 17px; height: 17px; }
.cdate__pop {
    position: absolute; left: 0; top: calc(100% + 6px);
    width: 286px; max-width: calc(100vw - 32px);
    background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: 12px; box-shadow: var(--shadow-lg); padding: 12px; z-index: 70; display: none;
}
.cdate.is-open .cdate__pop { display: block; }
.cdate__pop--up { top: auto; bottom: calc(100% + 6px); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-title { font-weight: 600; font-size: .9rem; }
.cal-nav { width: 30px; height: 30px; border: 0; background: none; border-radius: 8px; cursor: pointer; color: var(--text-muted); display: grid; place-items: center; }
.cal-nav:hover { background: var(--surface-2); color: var(--text); }
.cal-nav svg { width: 18px; height: 18px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-wd span { text-align: center; font-size: .64rem; color: var(--text-faint); font-weight: 600; padding: 4px 0; }
.cal-day { border: 0; background: none; aspect-ratio: 1; border-radius: 8px; font: inherit; font-size: .82rem; color: var(--text); cursor: pointer; }
.cal-day:hover:not(.is-disabled) { background: var(--surface-2); }
.cal-day.is-today { color: var(--brand); font-weight: 600; }
.cal-day.is-selected { background: var(--brand); color: #fff; font-weight: 600; }
.cal-day.is-disabled { color: var(--text-faint); opacity: .4; cursor: not-allowed; }

/* ------------------------------------------------------------- gráficos */

.chartwrap { position: relative; }
.chart { width: 100%; height: 200px; display: block; }
.guide { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border-strong); opacity: 0; pointer-events: none; transition: opacity .1s; }
.gdot { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: #fff; border: 2px solid var(--brand); transform: translate(-50%,-50%); opacity: 0; pointer-events: none; transition: opacity .1s; }
.tip { position: absolute; background: var(--navy-900); color: #fff; font-size: .74rem; padding: 7px 10px; border-radius: 8px; box-shadow: var(--shadow-lg); pointer-events: none; opacity: 0; transform: translate(-50%,-115%); white-space: nowrap; transition: opacity .1s; z-index: 20; }
.tip b { font-weight: 600; font-variant-numeric: tabular-nums; }
.tip .tm { color: #9FB2CE; font-size: .68rem; margin-bottom: 1px; }
.chart-axis { display: flex; justify-content: space-between; padding: 8px 4px 0; font-size: .7rem; color: var(--text-faint); }
.leg { display: flex; align-items: center; gap: 16px; font-size: .78rem; color: var(--text-muted); }
.leg span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.spark { flex: none; }

/* barra de distribuição + detalhamento (saldo por origem) */
.distbar { height: 10px; border-radius: 6px; overflow: hidden; display: flex; gap: 2px; background: var(--surface-3); }
.distbar > i { display: block; height: 100%; cursor: pointer; transition: filter .12s; }
.distbar > i:hover { filter: brightness(1.08) saturate(1.08); }
.breakdown { margin-top: var(--sp-4); display: flex; flex-direction: column; }
.brow { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.brow .lft { display: flex; align-items: center; gap: 9px; color: var(--text-muted); font-size: .86rem; }
.brow .rgt { display: flex; align-items: baseline; gap: 10px; }
.brow .rgt b { font-weight: 600; font-size: .88rem; }
.brow .rgt em { font-style: normal; color: var(--text-faint); font-size: .75rem; min-width: 30px; text-align: right; }
.btotal { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 4px; }
.btotal b { font-size: 1.05rem; font-weight: 650; }

/* ================================================================
   Cartão de aporte com acompanhamento ao vivo.
   A sensação (número subindo, pulso verde) está preservada; agora
   sobre superfície clara.
   ================================================================ */

.invest-card { display: flex; flex-direction: column; }
.invest-card__head { text-align: center; margin-bottom: var(--sp-5); }
.invest-card__amount {
    font-size: clamp(1.3rem, 2.1vw, 1.9rem); font-weight: 600; letter-spacing: -.03em; line-height: 1.1;
    display: inline-flex; align-items: baseline; gap: 5px; white-space: nowrap; max-width: 100%; overflow: hidden;
}
.invest-card__currency { font-size: .78em; font-weight: 500; color: var(--brand); }
.invest-card__value { display: inline-block; transition: color .5s ease, transform .5s ease, text-shadow .5s ease; }
.invest-card__value.is-growing { color: var(--success); transform: scale(1.04); text-shadow: 0 0 16px rgba(14,159,110,.28); }
.invest-card__note { font-size: .72rem; margin-top: 7px; color: var(--text-faint); }

.invest-card__stats {
    display: grid; grid-template-columns: repeat(3, minmax(0,1fr));
    text-align: center; margin: var(--sp-4) 0 2px;
    border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
}
.invest-card__stats > div { padding: 11px 8px; min-width: 0; }
.invest-card__stats > div + div { border-left: 1px solid var(--border); }
.invest-card__stat { font-weight: 600; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.invest-card__stats .metric__label { font-size: .58rem; letter-spacing: .03em; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.invest-card__cycle {
    margin-top: auto; padding: var(--sp-3) var(--sp-4);
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
}
.invest-card__timer { font-variant-numeric: tabular-nums; color: var(--text); }
.invest-card__dates { font-size: .7rem; margin-top: 10px; text-align: center; color: var(--text-faint); }

.badge--success::before { animation: badge-pulse 2.4s ease-in-out infinite; }
@keyframes badge-pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.invest-card__investor {
    display: flex; align-items: center; gap: var(--sp-3);
    padding: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-4);
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
    text-decoration: none; color: inherit;
}
.invest-card__investor:hover { border-color: var(--brand); text-decoration: none; }
.invest-card__investor-name { display: block; font-weight: 600; font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invest-card__investor-mail { display: block; font-size: .72rem; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* grade dos cartões de aporte: 3 / 2 / 1 colunas por largura real */
.grid--cards { display: grid; gap: var(--sp-4); grid-template-columns: minmax(0,1fr); align-items: stretch; }
@media (min-width: 820px)  { .grid--cards { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (min-width: 1360px) { .grid--cards { grid-template-columns: repeat(3, minmax(0,1fr)); } }
.grid--cards .invest-card { height: 100%; padding: var(--sp-4); }
.grid--cards .invest-card > form:last-child,
.grid--cards .invest-card > a.btn:last-child { margin-top: var(--sp-3); }

/* ---------------------------------------------------- barra inferior mobile */

.tabbar { display: none; }

/* bottom sheet (filtros no celular) */
.sheet-bg { position: fixed; inset: 0; background: rgba(10,37,64,.42); opacity: 0; visibility: hidden; transition: .2s; z-index: 60; }
.sheet {
    position: fixed; left: 0; right: 0; bottom: 0; max-width: 520px; margin: 0 auto;
    background: #fff; border-radius: 22px 22px 0 0;
    padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
    transform: translateY(101%); transition: transform .26s cubic-bezier(.32,.72,0,1);
    z-index: 61; box-shadow: 0 -8px 44px rgba(10,37,64,.2);
}
body.sheet-open .sheet-bg { opacity: 1; visibility: visible; }
body.sheet-open .sheet { transform: translateY(0); }
.sheet .handle { width: 40px; height: 4px; border-radius: 2px; background: var(--border-strong); margin: 8px auto 18px; }
.sheet h5 { font-size: 1rem; font-weight: 600; margin-bottom: var(--sp-4); }
.flabel { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 600; margin: var(--sp-4) 0 8px; }
.pgrid { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; }
.pgrid button, .pgrid a { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 10px; padding: 12px; font: inherit; font-size: .88rem; font-weight: 500; color: var(--text-muted); cursor: pointer; text-decoration: none; text-align: center; }
.pgrid button.on, .pgrid a.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.sheet-actions { display: flex; gap: 10px; margin-top: var(--sp-5); justify-content: flex-end; }

/* filtro colapsado (só mobile) */
.filters-m { display: none; }
.fbtn { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; padding: 9px 14px; font-size: .85rem; font-weight: 550; color: var(--text-muted); cursor: pointer; }
.fbtn .badge-n { background: var(--brand); color: #fff; font-size: .66rem; font-weight: 700; border-radius: var(--radius-pill); padding: 1px 6px; }

@media (min-width: 901px) { .sheet-bg, .sheet { display: none; } }

/* ================================================================
   Celular
   ================================================================ */
@media (max-width: 900px) {
    .sidebar { display: none; }
    .main { margin-left: 0; }
    .content { padding: 18px 16px 96px; }
    .topbar { padding: 0 16px; }

    .tabbar {
        display: flex; position: fixed; inset: auto 0 0 0;
        background: rgba(255,255,255,.96); backdrop-filter: blur(12px);
        border-top: 1px solid var(--border);
        padding: var(--sp-2) var(--sp-1) calc(var(--sp-2) + env(safe-area-inset-bottom));
        z-index: 50;
    }
    .tabbar__item {
        flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
        padding: 6px 2px; color: var(--text-faint);
        font-size: .62rem; font-weight: 500; text-decoration: none;
        border-radius: 10px; min-height: 48px; justify-content: center;
    }
    .tabbar__item:hover { text-decoration: none; }
    .tabbar__icon { width: 20px; height: 20px; }
    .tabbar__item--active { color: var(--brand); }

    .filters { display: none; }
    .filters-m { display: inline-flex; }

    .metric__value { font-size: 1.3rem; }
    h1, .page-title { font-size: 1.3rem; }
    .card { padding: var(--sp-4); border-radius: var(--radius); }
    .grid--4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 420px) {
    .grid--4 { grid-template-columns: minmax(0,1fr); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

@media print {
    .sidebar, .tabbar, .topbar, .btn { display: none !important; }
    .main, .content { margin-left: 0; }
    body { background: #fff; color: #000; }
    .card { border: 1px solid #ccc; box-shadow: none; }
}
