/* =========================================================
   NOXFINANCE — COMPONENTES
   ========================================================= */

/* ---------------------------------------------------------
   Logotipo
   --------------------------------------------------------- */
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-mark {
    width: 38px; height: 38px; border-radius: 50%;
    display: block; object-fit: cover;
    flex-shrink: 0;
}
.brand-name {
    font-family: var(--font-display); font-weight: 600;
    font-size: 20px; color: var(--white); letter-spacing: -.01em;
}
.brand-name span { color: var(--gold); }

/* ---------------------------------------------------------
   Botões
   --------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 9px; height: 46px; padding: 0 24px;
    border-radius: var(--r-sm); border: 1px solid transparent;
    font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
    transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease),
                background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.btn i { font-size: 14px; }
.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--gold);
    color: var(--on-gold);
}
.btn-primary:hover { background: #FFC72C; transform: translateY(-1px); box-shadow: var(--shadow-gold); }

.btn-secondary {
    background: transparent; border-color: var(--line); color: var(--white);
}
.btn-secondary:hover { border-color: var(--gray-500); background: var(--surface-2); transform: translateY(-1px); }

.btn-ghost { background: transparent; color: var(--gray-300); height: 40px; padding: 0 14px; }
.btn-ghost:hover { color: var(--white); background: var(--surface-2); }

.btn-danger { background: var(--danger-soft); color: #FF9297; border-color: rgba(229,72,77,.35); }
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm { height: 38px; padding: 0 16px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

.spinner {
    width: 15px; height: 15px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,.35); border-top-color: currentColor;
    display: inline-block; animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
    width: 42px; height: 42px; border-radius: var(--r-sm);
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface-2); border: 1px solid var(--line); color: var(--gray-300);
    cursor: pointer; transition: all var(--fast) var(--ease); position: relative;
}
.icon-btn:hover { color: var(--gold); border-color: var(--gold-dim); }

/* ---------------------------------------------------------
   Cards
   --------------------------------------------------------- */
.card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-lg); padding: 26px;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--med) var(--ease), box-shadow var(--med) var(--ease), transform var(--med) var(--ease);
}
.card-hover:hover { border-color: var(--gold-dim); box-shadow: var(--shadow-gold); transform: translateY(-2px); }

.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.card-title { font-size: 16px; font-weight: 600; color: var(--white); }
.card-subtitle { font-size: 13px; color: var(--gray-500); margin-top: 2px; }

/* ---- Stat card (ticker) ---- */
.stat-card { display: flex; flex-direction: column; gap: 14px; }
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; }
.stat-icon {
    width: 44px; height: 44px; border-radius: var(--r-sm);
    background: var(--gold-soft); color: var(--gold);
    display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.stat-value { font-family: var(--font-mono); font-size: 32px; font-weight: 600; letter-spacing: -.02em; color: var(--white); }
.stat-label { font-size: 13px; color: var(--gray-500); }
.stat-trend { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; }
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* ---------------------------------------------------------
   Formulários
   --------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field label { font-size: 13px; font-weight: 600; color: var(--gray-100); }
.field label .opt { font-weight: 400; color: var(--gray-500); }
.field label .opt-required { font-weight: 600; color: var(--gold); }

.input-wrap { position: relative; }
.input-wrap .leading {
    position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
    color: var(--gray-500); font-size: 14px; pointer-events: none;
}
.input-wrap .trailing {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    color: var(--gray-500); background: none; border: none; cursor: pointer; font-size: 14px; padding: 6px;
}
.input-wrap .trailing:hover { color: var(--gold); }

.input, select.input, textarea.input {
    width: 100%; height: 48px; background: var(--surface-2);
    border: 1px solid var(--line); border-radius: var(--r-sm);
    padding: 0 16px; color: var(--white); font-size: 14.5px;
    transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background var(--fast) var(--ease);
}
.input-wrap .input.has-leading { padding-left: 42px; }
.input-wrap .input.has-trailing { padding-right: 42px; }
textarea.input { height: auto; min-height: 110px; padding: 14px 16px; resize: vertical; }
.input::placeholder { color: var(--gray-500); }
.input:focus, select.input:focus, textarea.input:focus {
    outline: none; border-color: var(--gold-dim);
    box-shadow: 0 0 0 4px var(--gold-soft-2); background: var(--surface-3);
}
.input:disabled { opacity: .55; cursor: not-allowed; }

select.input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239B9BA6' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 16px center; padding-right: 40px;
}

.hint { font-size: 12.5px; color: var(--gray-500); }
.field.error .input { border-color: var(--danger); }
.field .error-msg { font-size: 12.5px; color: var(--danger); display: none; }
.field.error .error-msg { display: block; }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 44px; height: 25px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute; inset: 0; background: var(--surface-3); border-radius: var(--r-full);
    cursor: pointer; transition: background var(--fast) var(--ease); border: 1px solid var(--line);
}
.switch .slider::before {
    content: ''; position: absolute; width: 17px; height: 17px; left: 3px; top: 3px;
    background: var(--white); border-radius: 50%; transition: transform var(--fast) var(--ease);
}
.switch input:checked + .slider { background: var(--gold); border-color: var(--gold); }
.switch input:checked + .slider::before { transform: translateX(19px); background: var(--on-gold); }

.setting-row {
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
    padding: 18px 0; border-bottom: 1px solid var(--line-soft);
}
.setting-row:last-child { border-bottom: none; }
.setting-row .setting-title { font-size: 14px; font-weight: 600; color: var(--white); }
.setting-row .setting-desc { font-size: 12.5px; color: var(--gray-500); margin-top: 3px; }

/* Checkbox / Radio customizados */
.check-row { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--gray-100); cursor: pointer; }
.check-row input { accent-color: var(--gold); width: 17px; height: 17px; cursor: pointer; }

/* Upload de documento */
.upload-box {
    border: 1.5px dashed var(--line); border-radius: var(--r-md);
    padding: 28px; text-align: center; cursor: pointer;
    transition: all var(--fast) var(--ease); background: var(--surface-2);
}
.upload-box:hover { border-color: var(--gold-dim); background: var(--gold-soft-2); }
.upload-box i { font-size: 24px; color: var(--gold); margin-bottom: 10px; }
.upload-box .upload-title { font-size: 14px; font-weight: 600; color: var(--white); margin-bottom: 4px; }
.upload-box .upload-sub { font-size: 12.5px; color: var(--gray-500); }

/* ---------------------------------------------------------
   Badges / Status
   --------------------------------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px; border-radius: var(--r-full);
    font-size: 12px; font-weight: 600; letter-spacing: .01em;
    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(--gold-soft); color: var(--gold); }
.badge-danger  { background: var(--danger-soft); color: #FF8489; }
.badge-info    { background: var(--info-soft); color: var(--info); }
.badge-neutral { background: var(--surface-3); color: var(--gray-300); }

/* ---------------------------------------------------------
   Tabela
   --------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); }
/* Variante com altura limitada a ~10 linhas + cabeçalho fixo, com rolagem
   vertical pro resto. Usada em tabelas que podem crescer bastante (ex.:
   Aportes e Clientes no painel admin). */
.table-wrap.scroll-10 { max-height: 696px; overflow-y: auto; }
.table-wrap.scroll-10 table.table thead th { position: sticky; top: 0; z-index: 1; }
table.table { width: 100%; border-collapse: collapse; min-width: 640px; }
table.table thead th {
    text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: var(--gray-500);
    padding: 16px 20px; background: var(--surface-2); border-bottom: 1px solid var(--line);
}
table.table tbody td {
    padding: 16px 20px; font-size: 14px; color: var(--gray-100);
    border-bottom: 1px solid var(--line-soft);
}
table.table tbody tr { transition: background var(--fast) var(--ease); }
table.table tbody tr:hover { background: var(--surface-2); }
table.table tbody tr:last-child td { border-bottom: none; }
.row-title { color: var(--white); font-weight: 600; }
.row-sub { color: var(--gray-500); font-size: 12.5px; margin-top: 2px; }

/* ---------------------------------------------------------
   Avatar
   --------------------------------------------------------- */
.avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--gold-soft); color: var(--gold);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.avatar-lg { width: 84px; height: 84px; font-size: 26px; }

/* ---------------------------------------------------------
   Progresso / Timeline
   --------------------------------------------------------- */
.progress-track { height: 8px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.progress-fill { height: 100%; border-radius: var(--r-full); background: var(--gold); transition: width var(--med) var(--ease); }

.timeline { display: flex; flex-direction: column; }
.timeline-step { display: flex; gap: 16px; position: relative; padding-bottom: 28px; }
.timeline-step:last-child { padding-bottom: 0; }
.timeline-step::before {
    content: ''; position: absolute; left: 13px; top: 30px; bottom: 0; width: 1.5px; background: var(--line);
}
.timeline-step:last-child::before { display: none; }
.timeline-dot {
    width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 12px;
    background: var(--surface-2); border: 1.5px solid var(--line); color: var(--gray-500); z-index: 1;
}
.timeline-step.done .timeline-dot { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.timeline-step.active .timeline-dot { background: var(--gold-soft); border-color: var(--gold); color: var(--gold); }
.timeline-title { font-size: 14px; font-weight: 600; color: var(--white); }
.timeline-desc { font-size: 12.5px; color: var(--gray-500); margin-top: 2px; }

/* ---------------------------------------------------------
   Donut (aprovação, taxa)
   --------------------------------------------------------- */
.donut {
    width: 132px; height: 132px; border-radius: 50%; position: relative;
    display: flex; align-items: center; justify-content: center;
}
.donut::before {
    content: ''; position: absolute; inset: 12px; background: var(--surface); border-radius: 50%;
}
.donut-value { position: relative; z-index: 1; font-family: var(--font-mono); font-size: 22px; font-weight: 700; color: var(--white); }

/* ---------------------------------------------------------
   Barras (gráfico simples sem dependências)
   --------------------------------------------------------- */
.bar-chart { display: flex; align-items: flex-end; gap: 14px; height: 160px; padding-top: 10px; }
.bar-col { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; height: 100%; justify-content: flex-end; }
.bar-col .bar {
    width: 100%; max-width: 34px; border-radius: 6px 6px 0 0;
    background: var(--gold);
    transition: height 700ms var(--ease);
    cursor: pointer;
}
.bar-col .bar-label { font-size: 11px; color: var(--gray-500); }

/* Valor da barra: tooltip único, fixo na tela (não vive dentro do
   .bar-chart) porque o container do gráfico tem overflow-x:auto no
   mobile — qualquer elemento absoluto que "vazasse" pra cima dele
   era cortado junto com o overflow-y. Posição calculada via JS. */
.bar-tooltip-float {
    position: fixed;
    background: var(--surface-3);
    border: 1px solid var(--line);
    color: var(--white);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: var(--r-sm);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--fast) var(--ease);
    z-index: 1000;
    box-shadow: var(--shadow-sm);
    transform: translate(-50%, -100%);
}
.bar-tooltip-float.show { opacity: 1; }

/* ---------------------------------------------------------
   Alertas / Mensagens
   --------------------------------------------------------- */
.alert {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 16px; border-radius: var(--r-sm); font-size: 13.5px;
    border: 1px solid transparent;
}
.alert i { font-size: 15px; margin-top: 1px; }
.alert-success { background: var(--success-soft); color: var(--success); border-color: rgba(52,199,123,.3); }
.alert-danger  { background: var(--danger-soft); color: #FF9297; border-color: rgba(229,72,77,.3); }
.alert-info    { background: var(--info-soft); color: var(--info); border-color: rgba(76,159,231,.3); }

/* ---------------------------------------------------------
   Modal
   --------------------------------------------------------- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(5, 5, 6, .72);
    backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center;
    z-index: 200; opacity: 0; pointer-events: none; transition: opacity var(--med) var(--ease);
    padding: 20px;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-panel {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
    width: 100%; max-width: 480px; padding: 28px; box-shadow: var(--shadow-md);
    transform: translateY(14px) scale(.98); transition: transform var(--med) var(--ease);
}
.modal-overlay.active .modal-panel { transform: translateY(0) scale(1); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.modal-title { font-size: 18px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--gray-500); font-size: 18px; cursor: pointer; }
.modal-close:hover { color: var(--white); }
.modal-body { margin: 18px 0 24px; color: var(--gray-300); font-size: 14px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; }

.confirm-icon {
    width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 16px;
    display: flex; align-items: center; justify-content: center;
    background: var(--info-soft); color: var(--info); font-size: 20px;
}
.confirm-icon.danger { background: var(--danger-soft); color: #FF9297; }
.confirm-icon.success { background: var(--success-soft); color: var(--success); }
.confirm-icon.warning { background: var(--gold-soft); color: var(--gold); }

/* ---------------------------------------------------------
   Tabs
   --------------------------------------------------------- */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.tab-btn {
    background: none; border: none; padding: 12px 4px; margin-right: 22px;
    color: var(--gray-500); font-size: 14px; font-weight: 600; cursor: pointer;
    position: relative; transition: color var(--fast) var(--ease);
}
.tab-btn::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
    background: var(--gold); transform: scaleX(0); transition: transform var(--fast) var(--ease);
}
.tab-btn.active { color: var(--white); }
.tab-btn.active::after { transform: scaleX(1); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn var(--med) var(--ease); }

/* ---------------------------------------------------------
   Busca
   --------------------------------------------------------- */
.search-box { position: relative; flex: 1; max-width: 420px; min-width: 200px; }
.search-box i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--gray-500); font-size: 14px; }
.search-box input { width: 100%; height: 44px; padding: 0 16px 0 42px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--white); font-size: 14px; }
.search-box input:focus { outline: none; border-color: var(--gold-dim); box-shadow: 0 0 0 4px var(--gold-soft-2); }

/* ---------------------------------------------------------
   Estado vazio
   --------------------------------------------------------- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--gray-500); }
.empty-state i { font-size: 32px; color: var(--surface-3); margin-bottom: 14px; display: block; }
.empty-state .empty-title { color: var(--white); font-weight: 600; font-size: 15px; margin-bottom: 6px; }

/* ---------------------------------------------------------
   Animações
   --------------------------------------------------------- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.reveal { animation: fadeInUp var(--med) var(--ease) both; }
.reveal-1 { animation-delay: 60ms; } .reveal-2 { animation-delay: 120ms; }
.reveal-3 { animation-delay: 180ms; } .reveal-4 { animation-delay: 240ms; }

@media (max-width: 720px) {
    .field-row { grid-template-columns: 1fr; gap: 0; }
}

@media (max-width: 640px) {
    /* Cards mais compactos em telas pequenas */
    .card { padding: 18px; border-radius: var(--r-md); }
    .card-header { margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
    .card-header > * { max-width: 100%; }
    /* Campos de busca dentro do card-header (ex.: painel admin) usam max-width
       inline em px; forçamos largura total no mobile. */
    .card-header input.input { max-width: 100% !important; width: 100%; }

    /* Botões ocupam melhor a largura disponível e não colam nas bordas */
    .btn { height: 44px; padding: 0 18px; font-size: 13.5px; }
    .btn-sm { height: 36px; padding: 0 14px; }

    /* Stat card */
    .stat-value { font-size: 26px; }
    .stat-icon { width: 38px; height: 38px; font-size: 16px; }

    /* Formulário */
    .input, select.input, textarea.input { height: 46px; font-size: 14px; }
    .field { margin-bottom: 14px; }

    /* Modal ocupa a tela quase toda, sem sobrar espaço nas laterais.
       !important necessário pois alguns modais definem max-width inline (ex.: painel admin). */
    .modal-overlay { padding: 12px; align-items: flex-end; }
    .modal-panel { padding: 20px; max-width: 100% !important; max-height: 88vh !important; }
    .modal-actions { flex-direction: column-reverse; gap: 8px; }
    .modal-actions .btn { width: 100%; }

    /* Tabs: espaçamento menor pra caber mais itens na rolagem horizontal */
    .tab-btn { margin-right: 16px; font-size: 13.5px; padding: 10px 2px; }

    /* Busca ocupa a largura total */
    .search-box { max-width: none; min-width: 0; }

    /* Donut e gráfico de barras reduzidos.
       Com 12 colunas, o flex:1 do desktop não tinha espaço pra encolher no
       mobile (o texto do mês, ex. "Set/25", precisa de uma largura mínima)
       e o gráfico vazava pra fora do card. Aqui trocamos por colunas de
       largura fixa com rolagem horizontal dentro do próprio card. */
    .donut { width: 104px; height: 104px; }
    .donut-value { font-size: 18px; }
    .bar-chart {
        height: 130px; gap: 10px;
        overflow-x: auto; -webkit-overflow-scrolling: touch;
        scrollbar-width: none; -ms-overflow-style: none;
        margin: 0 -18px; padding: 10px 18px 4px;
    }
    .bar-chart::-webkit-scrollbar { display: none; }
    .bar-chart .bar-col { flex: 0 0 auto; width: 34px; }

    /* Avatar grande menor no mobile */
    .avatar-lg { width: 68px; height: 68px; font-size: 20px; }

    /* Tabela: cabeçalho e células com menos espaçamento */
    table.table thead th { padding: 12px 14px; font-size: 10.5px; }
    table.table tbody td { padding: 12px 14px; font-size: 13.5px; }
    table.table { min-width: 560px; }

    .upload-box { padding: 20px; }
    .empty-state { padding: 40px 16px; }
}
