/* ═══════════════════════════════════════════
   DESIGN SYSTEM — Dashboard Asaas v2
   ═══════════════════════════════════════════ */

:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #111128;
    --bg-card: rgba(20, 20, 50, 0.6);
    --bg-glass: rgba(255, 255, 255, 0.04);
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --text-muted: rgba(255, 255, 255, 0.35);

    --green: #00e676;
    --green-bg: rgba(0, 230, 118, 0.12);
    --blue: #448aff;
    --blue-bg: rgba(68, 138, 255, 0.12);
    --yellow: #ffea00;
    --yellow-bg: rgba(255, 234, 0, 0.12);
    --red: #ff5252;
    --red-bg: rgba(255, 82, 82, 0.12);
    --purple: #b388ff;
    --purple-bg: rgba(179, 136, 255, 0.12);
    --orange: #ff9100;
    --orange-bg: rgba(255, 145, 0, 0.12);

    --accent: #6366f1;
    --accent-hover: #818cf8;

    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    z-index: 0;
    pointer-events: none;
}

body::before {
    width: 600px;
    height: 600px;
    background: rgba(99, 102, 241, 0.08);
    top: -200px;
    right: -200px;
}

body::after {
    width: 500px;
    height: 500px;
    background: rgba(139, 92, 246, 0.06);
    bottom: -200px;
    left: -200px;
}

/* ═══════════════════
   AUTH SCREEN
   ═══════════════════ */
.auth-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.auth-card {
    background: var(--bg-card);
    backdrop-filter: blur(40px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 48px 40px;
    max-width: 460px;
    width: 100%;
    text-align: center;
    animation: fadeUp 0.6s ease-out;
}

.auth-logo {
    margin-bottom: 24px;
}

.auth-card h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #fff, rgba(255, 255, 255, 0.6));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-card>p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 32px;
}

.auth-input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.auth-login-form {
    flex-direction: column;
}

.auth-login-form button {
    width: 100%;
}

.auth-input-group input {
    flex: 1;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.auth-input-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.auth-input-group input::placeholder {
    color: var(--text-muted);
}

.auth-input-group button {
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border: none;
    border-radius: var(--radius-sm);
    padding: 14px 24px;
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.3s;
    white-space: nowrap;
}

.auth-input-group button:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

.auth-hint {
    color: var(--text-muted) !important;
    font-size: 0.78rem !important;
    margin-bottom: 0 !important;
}

.auth-error {
    color: var(--red) !important;
    font-size: 0.85rem !important;
    margin-top: 4px !important;
    margin-bottom: 0 !important;
    min-height: 20px;
}

.btn-loader {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ═══════════════════
   DASHBOARD LAYOUT
   ═══════════════════ */
.dashboard {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 32px 48px;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    animation: fadeUp 0.4s ease-out;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-logo {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header h1 {
    font-size: 1.4rem;
    font-weight: 700;
}

.header p {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 2px;
}

.header-right {
    display: flex;
    gap: 8px;
}

.btn-refresh,
.btn-logout {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-refresh:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}

.btn-logout:hover {
    color: var(--red);
    border-color: var(--red);
    background: rgba(255, 82, 82, 0.1);
}

/* LOADING */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 26, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

.loading-content p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ═══════════════════
   PERIOD FILTER
   ═══════════════════ */
.period-filter {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    animation: fadeUp 0.4s ease-out 0.1s backwards;
}

.period-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.period-buttons {
    display: flex;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px;
}

.period-btn {
    background: transparent;
    border: none;
    border-radius: var(--radius-xs);
    padding: 8px 18px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s;
}

.period-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.period-btn.active {
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

/* ═══════════════════
   KPI CARDS
   ═══════════════════ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    backdrop-filter: blur(40px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
    animation: fadeUp 0.5s ease-out backwards;
}

.kpi-card:nth-child(1) {
    animation-delay: 0.05s;
}

.kpi-card:nth-child(2) {
    animation-delay: 0.1s;
}

.kpi-card:nth-child(3) {
    animation-delay: 0.15s;
}

.kpi-card:nth-child(4) {
    animation-delay: 0.2s;
}

.kpi-card:nth-child(5) {
    animation-delay: 0.25s;
}

.kpi-card:nth-child(6) {
    animation-delay: 0.3s;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpi-received .kpi-icon {
    background: var(--green-bg);
    color: var(--green);
}

.kpi-receivable .kpi-icon {
    background: var(--blue-bg);
    color: var(--blue);
}

.kpi-pending .kpi-icon {
    background: var(--yellow-bg);
    color: var(--yellow);
}

.kpi-overdue .kpi-icon {
    background: var(--red-bg);
    color: var(--red);
}

.kpi-customers .kpi-icon {
    background: var(--purple-bg);
    color: var(--purple);
}

.kpi-fees .kpi-icon {
    background: var(--orange-bg);
    color: var(--orange);
}

.kpi-received:hover {
    border-color: rgba(0, 230, 118, 0.3);
}

.kpi-receivable:hover {
    border-color: rgba(68, 138, 255, 0.3);
}

.kpi-pending:hover {
    border-color: rgba(255, 234, 0, 0.3);
}

.kpi-overdue:hover {
    border-color: rgba(255, 82, 82, 0.3);
}

.kpi-due-soon .kpi-icon {
    background: var(--orange-bg);
    color: var(--orange);
}

.kpi-due-soon:hover {
    border-color: rgba(255, 145, 0, 0.3);
}

.kpi-customers:hover {
    border-color: rgba(179, 136, 255, 0.3);
}

.kpi-fees:hover {
    border-color: rgba(255, 145, 0, 0.3);
}

.kpi-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.kpi-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.kpi-value {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-count {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ═══════════════════
   CHARTS
   ═══════════════════ */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--bg-card);
    backdrop-filter: blur(40px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    animation: fadeUp 0.5s ease-out 0.2s backwards;
}

.chart-card h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.chart-container {
    position: relative;
    height: 280px;
}

.chart-bar-container {
    height: 280px;
}

/* ═══════════════════
   RANKING LISTS
   ═══════════════════ */
.ranking-card {
    display: flex;
    flex-direction: column;
}

.ranking-list {
    flex: 1;
    overflow-y: auto;
    max-height: 340px;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-xs);
    transition: background 0.2s;
    animation: fadeUp 0.3s ease-out backwards;
}

.ranking-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.ranking-item+.ranking-item {
    border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.rank-position {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.fee-icon {
    font-size: 1.2rem;
    border: none;
    background: transparent;
}

.rank-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.rank-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-badge {
    font-size: 0.7rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 10px;
    width: fit-content;
}

.rank-green {
    background: var(--green-bg);
    color: var(--green);
}

.rank-red {
    background: var(--red-bg);
    color: var(--red);
}

.rank-purple {
    background: var(--purple-bg);
    color: var(--purple);
}

.rank-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    flex-shrink: 0;
}

.fee-value {
    color: var(--orange) !important;
}

.empty-msg {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 40px 16px;
}

/* ═══════════════════
   TABLE
   ═══════════════════ */
.table-section {
    background: var(--bg-card);
    backdrop-filter: blur(40px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    animation: fadeUp 0.5s ease-out 0.3s backwards;
}

.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.table-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.table-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 8px 14px;
    color: var(--text-secondary);
    transition: border-color 0.2s;
}

.search-box:focus-within {
    border-color: var(--accent);
}

.search-box input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    width: 180px;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

#status-filter {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 8px 14px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

#status-filter:focus {
    border-color: var(--accent);
}

#status-filter option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 12px 14px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

td {
    padding: 12px 14px;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
}

.td-name {
    font-weight: 500;
    color: var(--text-primary);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.td-value {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.status-RECEIVED,
.status-RECEIVED_IN_CASH {
    background: var(--green-bg);
    color: var(--green);
}

.status-CONFIRMED {
    background: var(--green-bg);
    color: var(--green);
}

.status-PENDING {
    background: var(--yellow-bg);
    color: var(--yellow);
}

.status-OVERDUE {
    background: var(--red-bg);
    color: var(--red);
}

.status-REFUNDED {
    background: var(--purple-bg);
    color: var(--purple);
}

.btn-invoice {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 6px 12px;
    color: var(--accent);
    font-size: 0.78rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-invoice:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--accent);
}

/* Client grouped rows */
.client-row {
    cursor: pointer;
    transition: background 0.2s;
}

.client-row:hover {
    background: rgba(255, 255, 255, 0.04) !important;
}

.client-row.expanded {
    background: rgba(99, 102, 241, 0.06);
    border-left: 3px solid var(--accent);
}

.td-arrow {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    width: 30px;
    padding: 0 4px !important;
    transition: color 0.2s;
}

.client-row:hover .td-arrow {
    color: var(--accent);
}

/* Detail row (expanded payments) */
.detail-row>td {
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
}

.detail-container {
    background: rgba(99, 102, 241, 0.03);
    border-left: 3px solid var(--accent);
    border-bottom: 1px solid rgba(99, 102, 241, 0.12);
    padding: 8px 12px 12px 36px;
    animation: slideDown 0.25s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        max-height: 1000px;
        transform: translateY(0);
    }
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.detail-table thead th {
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.detail-table tbody td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
}

.detail-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.detail-table tbody tr:last-child td {
    border-bottom: none;
}

.status-badge.status-other {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}

.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

#table-info {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.pagination {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pagination button {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 8px 16px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}

.pagination button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

#page-info {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ═══════════════════
   ANIMATIONS
   ═══════════════════ */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ═══════════════════
   SCROLLBAR
   ═══════════════════ */
.ranking-list::-webkit-scrollbar {
    width: 4px;
}

.ranking-list::-webkit-scrollbar-track {
    background: transparent;
}

.ranking-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.ranking-list::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* ═══════════════════
   HIDE/SHOW VALUES
   ═══════════════════ */
.btn-eye {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-eye:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}

.values-hidden .kpi-value,
.values-hidden .td-value,
.values-hidden .rank-value,
.values-hidden .cost-kpi-count {
    filter: blur(10px);
    user-select: none;
    transition: filter 0.25s ease;
}

.values-hidden .kpi-card:hover .kpi-value,
.values-hidden tr:hover .td-value,
.values-hidden .ranking-item:hover .rank-value,
.values-hidden .eff-kpi:hover .eff-kpi-value,
.values-hidden .cost-kpi-card:hover .kpi-value,
.values-hidden .cost-kpi-card:hover .cost-kpi-count {
    filter: blur(0);
}

.values-hidden .eff-kpi-value {
    filter: blur(10px);
    user-select: none;
    transition: filter 0.25s ease;
}

.values-hidden .cost-type-badge {
    filter: blur(6px);
    user-select: none;
    transition: filter 0.25s ease;
}

.values-hidden tr:hover .cost-type-badge {
    filter: blur(0);
}

/* ═══════════════════
   EFFECTIVENESS SECTION
   ═══════════════════ */
.effectiveness-section {
    background: var(--bg-card);
    backdrop-filter: blur(40px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    animation: fadeUp 0.5s ease-out 0.25s backwards;
}

.section-header-row {
    margin-bottom: 20px;
}

.section-header-row h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.eff-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.eff-kpi {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    text-align: center;
    transition: all 0.25s;
}

.eff-kpi:hover {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.06);
    transform: translateY(-2px);
}

.eff-kpi-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
    transition: filter 0.25s ease;
}

.eff-kpi-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* FUNNEL */
.funnel-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: var(--radius-xs);
    transition: background 0.2s;
    animation: fadeUp 0.3s ease-out backwards;
}

.funnel-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.funnel-item+.funnel-item {
    border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.funnel-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.funnel-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.funnel-info {
    flex: 1;
    min-width: 0;
}

.funnel-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
    display: block;
    margin-bottom: 6px;
}

.funnel-bar-bg {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.funnel-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.funnel-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    margin-left: 16px;
    flex-shrink: 0;
}

.funnel-count {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.funnel-pct {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ═══════════════════
   RESPONSIVE
   ═══════════════════ */
@media (max-width: 1200px) {
    .kpi-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .dashboard {
        padding: 16px;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .eff-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .period-filter {
        flex-wrap: wrap;
    }

    .period-buttons {
        flex-wrap: wrap;
    }
}

@media (max-width: 600px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .auth-card {
        padding: 32px 24px;
    }

    .auth-input-group {
        flex-direction: column;
    }

    .table-controls {
        flex-direction: column;
        width: 100%;
    }

    .search-box {
        width: 100%;
    }

    .search-box input {
        width: 100%;
    }

    #status-filter {
        width: 100%;
    }

    .period-buttons {
        width: 100%;
    }

    .period-btn {
        flex: 1;
        text-align: center;
        padding: 8px 10px;
    }

    .costs-kpi-grid {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════════
   COSTS DASHBOARD
   ═══════════════════ */
.costs-section {
    background: var(--bg-card);
    backdrop-filter: blur(40px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 24px;
    animation: fadeUp 0.5s ease-out 0.35s backwards;
}

.costs-section>.section-header-row {
    margin-bottom: 20px;
}

.costs-kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.cost-kpi-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 18px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
    animation: fadeUp 0.4s ease-out backwards;
}

.cost-kpi-card:nth-child(1) {
    animation-delay: 0.05s;
}

.cost-kpi-card:nth-child(2) {
    animation-delay: 0.1s;
}

.cost-kpi-card:nth-child(3) {
    animation-delay: 0.15s;
}

.cost-kpi-card:nth-child(4) {
    animation-delay: 0.2s;
}

.cost-kpi-card:nth-child(5) {
    animation-delay: 0.25s;
}

.cost-kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.cost-kpi-total {
    border-left: 3px solid #6366f1;
}

.cost-kpi-total:hover {
    border-color: #6366f1;
}

.cost-kpi-payment {
    border-left: 3px solid #8b5cf6;
}

.cost-kpi-payment:hover {
    border-color: #8b5cf6;
}

.cost-kpi-transfer {
    border-left: 3px solid #06b6d4;
}

.cost-kpi-transfer:hover {
    border-color: #06b6d4;
}

.cost-kpi-anticipation {
    border-left: 3px solid #ec4899;
}

.cost-kpi-anticipation:hover {
    border-color: #ec4899;
}

.cost-kpi-other {
    border-left: 3px solid #fb923c;
}

.cost-kpi-other:hover {
    border-color: #fb923c;
}

.cost-kpi-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cost-kpi-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.cost-kpi-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 3px;
}

.cost-kpi-info .kpi-value {
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 3px;
}

.cost-kpi-count {
    font-size: 0.68rem;
    color: var(--text-muted);
}

/* Cost Extract */
.cost-extract-section {
    margin-top: 24px;
}

.cost-extract-section h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text-primary);
}

.cost-extract-table {
    width: 100%;
    border-collapse: collapse;
}

.cost-extract-table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.cost-extract-table td {
    padding: 10px 14px;
    font-size: 0.82rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
}

.cost-extract-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.cost-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.1);
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
}

.cost-negative {
    color: var(--red) !important;
    font-weight: 700 !important;
}

.cost-positive {
    color: var(--orange) !important;
    font-weight: 700 !important;
}

.td-desc {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.cost-extract-section .table-wrapper {
    max-height: 400px;
    overflow-y: auto;
}

/* Responsive: Costs */
@media (max-width: 1100px) {
    .costs-kpi-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .costs-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}