/* ============================================
   DASHBOARD CUSTOM STYLES - ideia.it
   ============================================ */

/* Cards de KPIs */
.kpi-card {
    border: none;
    border-radius: 12px;
    padding: 1.5rem;
    height: 100%;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}
.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1) !important;
}
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: 12px 12px 0 0;
}

.kpi-card .kpi-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.kpi-card .kpi-value {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}
.kpi-card .kpi-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    opacity: 0.8;
}
.kpi-card .kpi-sublabel {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    opacity: 0.6;
}

/* Variações de cor */
.kpi-blue { background: linear-gradient(145deg, #e3f2fd 0%, #f5fbff 100%); }
.kpi-blue::before { background: #1976d2; }
.kpi-blue .kpi-icon { background: #1976d2; color: white; }
.kpi-blue .kpi-value { color: #1565c0; }
.kpi-blue .kpi-label { color: #1976d2; }

.kpi-green { background: linear-gradient(145deg, #e8f5e9 0%, #f5fbf5 100%); }
.kpi-green::before { background: #388e3c; }
.kpi-green .kpi-icon { background: #388e3c; color: white; }
.kpi-green .kpi-value { color: #2e7d32; }
.kpi-green .kpi-label { color: #388e3c; }

.kpi-orange { background: linear-gradient(145deg, #fff3e0 0%, #fffbf5 100%); }
.kpi-orange::before { background: #f57c00; }
.kpi-orange .kpi-icon { background: #f57c00; color: white; }
.kpi-orange .kpi-value { color: #ef6c00; }
.kpi-orange .kpi-label { color: #f57c00; }

.kpi-red { background: linear-gradient(145deg, #ffebee 0%, #fff5f5 100%); }
.kpi-red::before { background: #d32f2f; }
.kpi-red .kpi-icon { background: #d32f2f; color: white; }
.kpi-red .kpi-value { color: #c62828; }
.kpi-red .kpi-label { color: #d32f2f; }

.kpi-purple { background: linear-gradient(145deg, #f3e5f5 0%, #faf5fb 100%); }
.kpi-purple::before { background: #7b1fa2; }
.kpi-purple .kpi-icon { background: #7b1fa2; color: white; }
.kpi-purple .kpi-value { color: #6a1b9a; }
.kpi-purple .kpi-label { color: #7b1fa2; }

.kpi-teal { background: linear-gradient(145deg, #e0f2f1 0%, #f5fafa 100%); }
.kpi-teal::before { background: #00796b; }
.kpi-teal .kpi-icon { background: #00796b; color: white; }
.kpi-teal .kpi-value { color: #00695c; }
.kpi-teal .kpi-label { color: #00796b; }

.kpi-dark { background: linear-gradient(145deg, #eceff1 0%, #f5f7f8 100%); }
.kpi-dark::before { background: #455a64; }
.kpi-dark .kpi-icon { background: #455a64; color: white; }
.kpi-dark .kpi-value { color: #37474f; font-size: 1.75rem; }
.kpi-dark .kpi-label { color: #455a64; }

/* Badges de tipo de documento */
.badge-tipo {
    font-size: 0.65rem;
    padding: 0.35em 0.75em;
    border-radius: 6px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
}
.badge-nfe { background: #e8f5e9; color: #2e7d32; border-color: #c8e6c9; }
.badge-nfce { background: #e3f2fd; color: #1565c0; border-color: #bbdefb; }
.badge-cte { background: #fff3e0; color: #ef6c00; border-color: #ffe0b2; }

/* Status SEFAZ */
.status-sefaz {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}
.status-sucesso { 
    background: #e8f5e9; 
    color: #2e7d32; 
}
.status-sucesso::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4caf50;
    display: inline-block;
    animation: pulse 2s infinite;
}
.status-erro { 
    background: #ffebee; 
    color: #c62828; 
}
.status-erro::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f44336;
    display: inline-block;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Valor em reais */
.valor-real {
    font-family: 'SF Mono', 'Segoe UI Mono', 'Roboto Mono', monospace;
    font-weight: 700;
    color: #252930;
    font-size: 0.9rem;
}

/* Tabela do dashboard */
.table-dashboard {
    font-size: 0.875rem;
    border-collapse: separate;
    border-spacing: 0;
}
.table-dashboard th {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.8px;
    color: #6c757d;
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
    padding: 0.75rem 1rem;
    white-space: nowrap;
}
.table-dashboard td {
    vertical-align: middle;
    border-bottom: 1px solid #f1f3f4;
    padding: 0.875rem 1rem;
}
.table-dashboard tbody tr:hover {
    background: #fafbff;
}
.table-dashboard tbody tr:last-child td {
    border-bottom: none;
}

/* Card header */
.card-header-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f1f3f4;
}
.card-header-action h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #252930;
    margin: 0;
    display: flex;
    align-items: center;
}
.card-header-action .btn-ver-todos {
    font-size: 0.8rem;
    color: #15a362;
    text-decoration: none;
    font-weight: 700;
    display: flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    transition: all 0.2s;
}
.card-header-action .btn-ver-todos:hover {
    background: #edfdf6;
    text-decoration: none;
}

/* Eventos */
.evento-item {
    padding: 1rem 0;
    border-bottom: 1px solid #f1f3f4;
    transition: background 0.2s;
}
.evento-item:hover {
    background: #fafbff;
    margin: 0 -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
}
.evento-item:last-child {
    border-bottom: none;
}
.evento-tipo {
    font-size: 0.8rem;
    font-weight: 700;
    color: #252930;
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.evento-tipo::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #15a362;
    display: inline-block;
}
.evento-chave {
    font-family: 'SF Mono', monospace;
    font-size: 0.75rem;
    color: #adb5bd;
    word-break: break-all;
    background: #f8f9fa;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
}

/* Estado vazio */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: #adb5bd;
}
.empty-state i {
    color: #e9ecef;
    margin-bottom: 0.75rem;
}

/* Responsivo */
@media (max-width: 991.98px) {
    .kpi-card .kpi-value {
        font-size: 1.75rem;
    }
    .kpi-card .kpi-icon {
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
    }
}

@media (max-width: 575.98px) {
    .kpi-card {
        padding: 1rem;
    }
    .kpi-card .kpi-value {
        font-size: 1.5rem;
    }
    .table-dashboard {
        font-size: 0.8rem;
    }
    .table-dashboard td, .table-dashboard th {
        padding: 0.625rem 0.75rem;
    }
}

.tabela-doc-wrapper {
    overflow-x: auto;        /* Scroll horizontal quando necessário */
    max-width: 100%;
}

.tabela-doc {
    table-layout: fixed;     /* Colunas respeitam larguras definidas */
    min-width: 950px;        /* Largura mínima para não quebrar feio */
}

.tabela-doc tbody td {
    overflow: hidden;
    text-overflow: ellipsis;  /* Truncate automático */
    white-space: nowrap;
    max-width: 0;             /* Força o truncate funcionar */
}

.sidepanel-toggler .profile-image {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-image {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}