/* Ecobit — design system comum a todas as páginas (eco-fintech).
   Complementa o Tailwind (CDN) com tokens da marca, o shell (sidebar/header),
   componentes reutilizáveis (cards, botões, campos, tabelas) e as peças do
   dashboard da conta (gráfico, transações, anel de progresso). */

:root {
    --eco-deep: #04302B;
    --eco-dark: #0B3D2E;
    --eco-lime: #5CF03A;
    --eco-green: #16A34A;
    --eco-gold: #C89116;
    --eco-gold-soft: #F6EBCF;
    --eco-surface: #F4F7F4;
    --eco-ink: #0F1F1A;
    --eco-muted: #6B7A74;
    --eco-line: #E7ECE8;
    --eco-danger: #D14343;
    --eco-radius: 20px;
    --eco-shadow: 0 1px 2px rgba(4, 48, 43, .04), 0 12px 32px -16px rgba(4, 48, 43, .14);
    --eco-shadow-hover: 0 1px 2px rgba(4, 48, 43, .05), 0 18px 40px -18px rgba(4, 48, 43, .22);
}

.eco-body {
    background: var(--eco-surface);
    font-family: 'Poppins', system-ui, sans-serif;
    color: var(--eco-ink);
    font-feature-settings: "tnum" 1;
    -webkit-font-smoothing: antialiased;
}

/* Logado x visitante (classe aplicada no <html> antes do paint). */
/* Modo app (logado, fora da landing) x modo site (visitante ou landing). */
html:not(.eco-app) .so-app,
html:not(.eco-app) .eco-sidebar,
html:not(.eco-app) .eco-sb-backdrop,
html.eco-app .so-site { display: none !important; }
@media (min-width: 1024px) { html.eco-app .eco-hdr-logo { display: none; } }

/* Staff não compra nem transfere: itens exclusivos de participante somem. */
html.eco-staff .so-participante { display: none !important; }
/* Na sidebar, staff vê as seções do Dashboard no lugar do menu de participante. */
html:not(.eco-staff) .so-staff,
html.eco-staff .so-nao-staff { display: none !important; }

html:not(.eco-logado) .so-logado,
html.eco-logado .so-anonimo { display: none !important; }

/* ---------- Página: cabeçalho e blocos de texto ---------- */

/* Conteúdo fluido: ocupa toda a largura disponível (sem faixas vazias nas laterais),
   com o respiro lateral crescendo junto com a tela. Mesmo gutter do header e do footer. */
:root { --eco-gutter: 1rem; }
@media (min-width: 640px) { :root { --eco-gutter: 1.5rem; } }
@media (min-width: 1024px) { :root { --eco-gutter: 2rem; } }
@media (min-width: 1536px) { :root { --eco-gutter: 2.5rem; } }
.eco-gutter { padding-left: var(--eco-gutter); padding-right: var(--eco-gutter); }

.eco-page { width: 100%; padding: 2rem var(--eco-gutter) 1rem; }
@media (min-width: 640px) { .eco-page { padding-top: 3rem; } }

.eco-page-head { margin-bottom: 2rem; }
@media (min-width: 640px) { .eco-page-head { margin-bottom: 2.5rem; } }
.eco-page-head h1 { font-size: 1.75rem; line-height: 1.2; font-weight: 600; letter-spacing: -.02em; color: var(--eco-dark); margin-top: .25rem; }
@media (min-width: 640px) { .eco-page-head h1 { font-size: 2rem; } }
.eco-page-head p.eco-lead { color: var(--eco-muted); margin-top: .5rem; max-width: 40rem; }

.eco-breadcrumb { font-size: 13px; color: var(--eco-muted); display: flex; align-items: center; gap: 6px; }
.eco-breadcrumb a:hover { color: var(--eco-ink); }

.eco-h2 { font-weight: 600; color: var(--eco-ink); font-size: 1rem; }

.eco-prose { color: #3F4D48; line-height: 1.75; font-size: 15px; }
.eco-prose > * + * { margin-top: 1rem; }
.eco-prose h2 { font-size: 1.05rem; font-weight: 600; color: var(--eco-dark); margin-bottom: .5rem; }
.eco-prose strong { color: var(--eco-ink); font-weight: 600; }

.eco-icon-tile {
    width: 44px; height: 44px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.eco-divider { height: 1px; background: var(--eco-line); }

/* ---------- Campos ---------- */

.eco-label { display: block; font-size: 12px; font-weight: 500; color: var(--eco-muted); margin-bottom: 6px; }

.eco-input {
    width: 100%;
    background: #fff;
    border: 1px solid #DCE3DE;
    border-radius: 12px;
    padding: .7rem .9rem;
    font-size: 14px;
    color: var(--eco-ink);
    transition: border-color .2s ease, box-shadow .2s ease;
}
.eco-input::placeholder { color: #9AA6A1; }
.eco-input:hover { border-color: #C5CFC9; }
.eco-input:focus { outline: none; border-color: var(--eco-green); box-shadow: 0 0 0 4px rgba(22, 163, 74, .12); }
.eco-input:disabled, .eco-input[readonly] { background: var(--eco-surface); }
.eco-input--sm { padding: .5rem .75rem; font-size: 13px; border-radius: 10px; }
select.eco-input {
    appearance: none;
    padding-right: 2.25rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7A74' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .75rem center;
    background-size: 16px;
}

/* ---------- Tabelas e linhas ---------- */

.eco-table { width: 100%; font-size: 13px; border-collapse: collapse; }
.eco-table thead th {
    text-align: left; font-size: 11px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase;
    color: var(--eco-muted); padding: 0 12px 10px; border-bottom: 1px solid var(--eco-line);
}
.eco-table tbody td { padding: 12px; border-bottom: 1px solid var(--eco-line); }
.eco-table tbody tr:last-child td { border-bottom: 0; }
.eco-table tbody tr { transition: background-color .15s ease; }
.eco-table tbody tr:hover { background: var(--eco-surface); }

.eco-row {
    background: #fff;
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: 0 1px 2px rgba(4, 48, 43, .04), 0 0 0 1px var(--eco-line);
    transition: box-shadow .2s ease;
}
.eco-row:hover { box-shadow: 0 1px 2px rgba(4, 48, 43, .04), 0 0 0 1px #D5DED8, 0 8px 20px -14px rgba(4, 48, 43, .25); }

.eco-empty { color: var(--eco-muted); font-size: 14px; text-align: center; padding: 2.5rem 1rem; }

/* ---------- Abas sublinhadas ---------- */

.eco-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.eco-tabs > button {
    font-size: 13px; font-weight: 500; color: var(--eco-muted);
    padding: 8px 14px; border-radius: 12px; transition: background-color .2s ease, color .2s ease;
}
.eco-tabs > button:hover { color: var(--eco-ink); background: rgba(255, 255, 255, .7); }
.eco-tabs > button.is-active,
.eco-tabs > button[data-active="true"] { background: #fff; color: var(--eco-ink); box-shadow: 0 1px 3px rgba(4, 48, 43, .12); }

/* ---------- Superfícies ---------- */

.eco-card {
    background: #fff;
    border-radius: var(--eco-radius);
    box-shadow: var(--eco-shadow);
}

.eco-card--hover { transition: box-shadow .25s ease, transform .25s ease; }
.eco-card--hover:hover { box-shadow: var(--eco-shadow-hover); transform: translateY(-2px); }

.eco-hero {
    border-radius: 24px;
    color: #fff;
    background:
        radial-gradient(120% 140% at 100% 0%, rgba(92, 240, 58, .18) 0%, rgba(92, 240, 58, 0) 55%),
        radial-gradient(90% 120% at 0% 100%, rgba(200, 145, 22, .16) 0%, rgba(200, 145, 22, 0) 60%),
        linear-gradient(135deg, var(--eco-dark) 0%, var(--eco-deep) 100%);
    box-shadow: 0 24px 48px -24px rgba(4, 48, 43, .55);
}

.eco-eyebrow {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--eco-muted);
}

/* ---------- Botões ---------- */

.eco-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    font-weight: 600;
    font-size: 14px;
    border-radius: 14px;
    padding: .8rem 1.25rem;
    white-space: nowrap;
    transition: transform .15s ease, background-color .2s ease, box-shadow .2s ease, color .2s ease;
}
.eco-btn:active { transform: scale(.97); }
@media (max-width: 400px) { .eco-btn { padding: .8rem .9rem; } }
.eco-btn:focus-visible { outline: 2px solid var(--eco-lime); outline-offset: 2px; }

.eco-btn--primary { background: var(--eco-lime); color: var(--eco-deep); }
.eco-btn--primary:hover { box-shadow: 0 8px 24px -8px rgba(92, 240, 58, .7); }

.eco-btn--ghost { background: rgba(255, 255, 255, .1); color: #fff; }
.eco-btn--ghost:hover { background: rgba(255, 255, 255, .18); }

.eco-btn--dark { background: var(--eco-dark); color: #fff; }
.eco-btn--dark:hover { background: var(--eco-deep); }

.eco-btn--outline { background: #fff; color: var(--eco-dark); box-shadow: inset 0 0 0 1px #DCE3DE; }
.eco-btn--outline:hover { box-shadow: inset 0 0 0 1px var(--eco-dark); }

.eco-btn--quiet { color: var(--eco-dark); }
.eco-btn--quiet:hover { background: var(--eco-surface); }

.eco-btn--danger { color: var(--eco-danger); background: #fff; box-shadow: inset 0 0 0 1px #F3CFCF; }
.eco-btn--danger:hover { background: #FEF2F2; }

.eco-btn--sm { font-size: 12px; padding: .45rem .8rem; border-radius: 10px; }
.eco-btn--block { width: 100%; }

.eco-btn:disabled,
.eco-btn[disabled] { background: #E5EAE7 !important; color: #9AA6A1 !important; box-shadow: none !important; cursor: not-allowed; transform: none; }

.eco-link {
    color: var(--eco-gold);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: .25rem;
}
.eco-link svg { transition: transform .2s ease; }
.eco-link:hover svg { transform: translateX(3px); }

/* ---------- Chips / segmentos ---------- */

.eco-segment {
    display: inline-flex;
    padding: 4px;
    gap: 2px;
    background: var(--eco-surface);
    border-radius: 12px;
}
.eco-segment button {
    font-size: 12px;
    font-weight: 500;
    color: var(--eco-muted);
    padding: 6px 12px;
    border-radius: 9px;
    transition: background-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.eco-segment button:hover { color: var(--eco-ink); }
.eco-segment button[aria-pressed="true"] {
    background: #fff;
    color: var(--eco-ink);
    box-shadow: 0 1px 3px rgba(4, 48, 43, .12);
}

/* ---------- Header ---------- */

.eco-menu {
    transform-origin: top right;
    transition: opacity .18s ease, transform .18s ease, visibility .18s;
}
.eco-menu[data-open="false"] { opacity: 0; transform: translateY(-4px) scale(.98); visibility: hidden; pointer-events: none; }
.eco-menu[data-open="true"] { opacity: 1; transform: none; visibility: visible; }

/* ---------- Sidebar ----------
   Desktop (≥1024px): fixa, 250px aberta / 72px recolhida; o body recebe o
   mesmo padding-left, então header, conteúdo e footer ocupam o espaço restante.
   Mobile: drawer de 250px sobre o conteúdo, com backdrop. */

:root { --eco-sb-open: 250px; --eco-sb-closed: 72px; --eco-sb-ease: cubic-bezier(.2, .8, .2, 1); }

.eco-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: var(--eco-sb-open);
    display: flex;
    flex-direction: column;
    background: #FBFCFA;
    border-right: 1px solid var(--eco-line);
    padding: 0 12px 16px;
    transition: transform .28s var(--eco-sb-ease), box-shadow .28s ease;
}
/* Largura/recuo só animam no clique de recolher/expandir (classe temporária), nunca em load/resize. */
.eco-sb-anim .eco-sidebar { transition: width .28s var(--eco-sb-ease), transform .28s var(--eco-sb-ease), box-shadow .28s ease; }

.eco-sb-top { height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; flex-shrink: 0; }
.eco-sb-logo { display: flex; align-items: center; gap: 6px; min-width: 0; }
.eco-sb-close {
    width: 36px; height: 36px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: var(--eco-muted);
}
.eco-sb-close:hover { background: var(--eco-surface); color: var(--eco-ink); }

.eco-sb-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; padding-top: 12px; overflow-y: auto; overflow-x: visible; }

.eco-sb-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 44px;
    padding: 0 13px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--eco-dark);
    transition: background-color .2s ease, color .2s ease;
    white-space: nowrap;
}
.eco-sb-item:hover { background: var(--eco-surface); }
.eco-sb-item:focus-visible { outline: 2px solid var(--eco-lime); outline-offset: 2px; }
.eco-sb-item[aria-current="page"] { background: #E9F8E4; color: var(--eco-deep); font-weight: 600; }
.eco-sb-item[aria-current="page"]::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 10px;
    bottom: 10px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--eco-lime);
}
.eco-sb-item[aria-current="page"] .eco-sb-icon { color: var(--eco-green); }

.eco-sb-icon { width: 20px; height: 20px; flex-shrink: 0; color: var(--eco-muted); transition: color .2s ease; }
.eco-sb-item:hover .eco-sb-icon { color: var(--eco-dark); }

.eco-sb-label { transition: opacity .18s ease, visibility .18s; }

.eco-sb-sep { height: 1px; background: var(--eco-line); margin: 12px 8px; }

.eco-sb-toggle { width: 100%; margin-top: 8px; color: var(--eco-muted); font-weight: 400; }
.eco-sb-arrow { transform-origin: 15px 12px; transition: transform .28s var(--eco-sb-ease); }

.eco-sb-backdrop {
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(4, 48, 43, .32);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s;
}

@media (min-width: 1024px) {
    .eco-app body { padding-left: var(--eco-sb-open); }
    .eco-app.eco-sb-anim body { transition: padding-left .28s var(--eco-sb-ease); }
    .eco-sb-close, .eco-sb-backdrop { display: none; }

    .eco-app.eco-sb-collapsed body { padding-left: var(--eco-sb-closed); }
    .eco-sb-collapsed .eco-sidebar { width: var(--eco-sb-closed); }
    .eco-sb-collapsed .eco-sb-top { padding: 0 13px; }
    .eco-sb-collapsed .eco-sb-label { opacity: 0; visibility: hidden; }
    .eco-sb-collapsed .eco-sb-arrow { transform: rotate(180deg); }

    /* Tooltip com o nome do item, só no modo recolhido. */
    .eco-sb-collapsed .eco-sb-item[data-tip]::after {
        content: attr(data-tip);
        position: absolute;
        left: calc(100% + 14px);
        top: 50%;
        transform: translate(-4px, -50%);
        background: var(--eco-deep);
        color: #fff;
        font-size: 12px;
        font-weight: 500;
        padding: 6px 10px;
        border-radius: 8px;
        white-space: nowrap;
        pointer-events: none;
        opacity: 0;
        transition: opacity .15s ease, transform .15s ease;
        box-shadow: 0 8px 24px -8px rgba(4, 48, 43, .5);
    }
    .eco-sb-collapsed .eco-sb-item:hover::after,
    .eco-sb-collapsed .eco-sb-item:focus-visible::after { opacity: 1; transform: translate(0, -50%); }
    .eco-sb-collapsed .eco-sb-nav { overflow: visible; }
}

@media (max-width: 1023.98px) {
    .eco-sidebar { transform: translateX(-100%); }
    .eco-sb-open .eco-sidebar { transform: none; box-shadow: 0 24px 48px -12px rgba(4, 48, 43, .35); }
    .eco-sb-open .eco-sb-backdrop { opacity: 1; visibility: visible; }
    .eco-sb-open body { overflow: hidden; }
    .eco-sb-toggle { display: none; }
}

/* O footer global (base.html) precisa de ~1200px no layout de 7 colunas; quando há
   menos espaço (sidebar aberta ou telas entre 1024 e ~1200px), usa 3 colunas como no tablet. */
.site-footer { container-type: inline-size; }
@media (min-width: 1024px) {
    @container (max-width: 1210px) {
        .site-footer > div:first-child { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    }
}

/* Sem animação no primeiro paint (estado restaurado do storage). */
.eco-sb-preload .eco-sidebar,
.eco-sb-preload body,
.eco-sb-preload .eco-sb-label { transition: none !important; }

/* ---------- Transações ---------- */

.eco-tx { transition: background-color .2s ease; border-radius: 14px; }
.eco-tx:hover { background: var(--eco-surface); }
.eco-tx-details {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .25s ease;
}
.eco-tx-details > div { overflow: hidden; }
.eco-tx[aria-expanded="true"] .eco-tx-details { grid-template-rows: 1fr; }
.eco-tx[aria-expanded="true"] .eco-tx-chevron { transform: rotate(180deg); }
.eco-tx-chevron { transition: transform .25s ease; }

/* ---------- Gráfico ---------- */

.eco-chart { position: relative; height: 240px; }
.eco-chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.eco-chart-line { fill: none; stroke: var(--eco-green); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.eco-chart-grid { stroke: var(--eco-line); stroke-width: 1; stroke-dasharray: 3 5; }
.eco-chart-label { font-size: 11px; fill: var(--eco-muted); }
.eco-chart-draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: eco-draw 1.1s ease-out forwards; }
.eco-chart-tip {
    position: absolute;
    top: 0;
    pointer-events: none;
    background: var(--eco-deep);
    color: #fff;
    font-size: 12px;
    line-height: 1.35;
    padding: 8px 10px;
    border-radius: 10px;
    white-space: nowrap;
    transform: translate(-50%, -110%);
    box-shadow: 0 8px 24px -8px rgba(4, 48, 43, .5);
    transition: opacity .15s ease;
}

@keyframes eco-draw { to { stroke-dashoffset: 0; } }

/* ---------- Impacto ---------- */

.eco-bar { height: 8px; border-radius: 999px; background: var(--eco-surface); overflow: hidden; display: flex; }
.eco-bar > span { height: 100%; transition: width 1s cubic-bezier(.2, .8, .2, 1); }

.eco-ring circle { fill: none; stroke-width: 10; }
.eco-ring .eco-ring-track { stroke: var(--eco-surface); }
.eco-ring .eco-ring-value {
    stroke: url(#eco-ring-gradient);
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    transition: stroke-dashoffset 1.2s cubic-bezier(.2, .8, .2, 1);
}

.eco-milestone-dot {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    flex-shrink: 0;
}

/* ---------- Carregamento e entrada ---------- */

.eco-skeleton {
    color: transparent !important;
    border-radius: 8px;
    background: linear-gradient(90deg, rgba(0, 0, 0, .06) 0%, rgba(0, 0, 0, .1) 50%, rgba(0, 0, 0, .06) 100%);
    background-size: 200% 100%;
    animation: eco-shimmer 1.4s ease-in-out infinite;
}
.eco-hero .eco-skeleton {
    background: linear-gradient(90deg, rgba(255, 255, 255, .08) 0%, rgba(255, 255, 255, .16) 50%, rgba(255, 255, 255, .08) 100%);
    background-size: 200% 100%;
}

.eco-reveal { opacity: 0; transform: translateY(8px); animation: eco-reveal .5s ease forwards; }
.eco-reveal:nth-child(2) { animation-delay: .06s; }
.eco-reveal:nth-child(3) { animation-delay: .12s; }
.eco-reveal:nth-child(4) { animation-delay: .18s; }

@keyframes eco-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@keyframes eco-reveal { to { opacity: 1; transform: none; } }

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