* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f0f4f8;
    min-height: 100vh;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 2px;
}

.app-container {
    display: flex;
    min-height: 100vh;
    background: #f0f4f8;
    flex-direction: row;
    justify-content: flex-start;
}

/* ========================================
   SIDEBAR - MENU LATERAL (AZUL ESCURO)
   ======================================== */
.app-sidebar {
    width: 260px;
    background: linear-gradient(180deg, #1e2a3a 0%, #0f1724 100%);
    color: #e2e8f0;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.08);
    z-index: 1000;
    transition: all 0.3s ease;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
    margin: 0;
}

.sidebar-header h2 i {
    color: #60a5fa;
    margin-right: 10px;
}

.sidebar-header p {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 5px;
}

.user-info-sidebar {
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    margin: 20px;
    border-radius: 12px;
    text-align: center;
}

.user-info-sidebar i {
    font-size: 2rem;
    color: #60a5fa;
    margin-bottom: 10px;
}

.user-info-sidebar .user-name {
    font-weight: 600;
    margin-bottom: 5px;
    color: #f1f5f9;
}

.user-info-sidebar .user-type {
    font-size: 0.75rem;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.1);
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0 0 80px 0;
}

.sidebar-menu li {
    margin: 5px 0;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #cbd5e1;
    text-decoration: none;
    transition: all 0.3s;
    border-radius: 10px;
    margin: 0 12px;
}

.sidebar-menu li a:hover {
    background: rgba(96, 165, 250, 0.15);
    color: white;
}

.sidebar-menu li a.active {
    background: rgba(96, 165, 250, 0.2);
    color: white;
    border-left: 3px solid #60a5fa;
}

.sidebar-menu li a i {
    width: 28px;
    font-size: 1.2rem;
    margin-right: 12px;
    color: #60a5fa;
    transition: all 0.3s;
}

.sidebar-menu li a:hover i,
.sidebar-menu li a.active i {
    color: #93c5fd;
}

.sidebar-menu li a span {
    flex: 1;
    font-size: 0.9rem;
}

.sidebar-menu .menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 15px 20px;
}

.sidebar-menu .menu-title {
    padding: 15px 20px 5px;
    color: #64748b;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.logout-btn {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    background: rgba(96, 165, 250, 0.15);
    color: #f1f5f9;
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.3s;
    margin: 20px 12px;
}

.logout-btn:hover {
    background: #ef4444;
    color: white;
}

.logout-btn i {
    margin-right: 12px;
    color: #60a5fa;
}

.logout-btn:hover i {
    color: white;
}

/* ========================================
   CONTEÚDO PRINCIPAL
   ======================================== */
.app-main {
    flex: 1;
    margin-left: 260px;
    padding: 25px;
    width: 100%;
    max-width: 100%;
    background: #f0f4f8;
}

/* Mobile Top Bar */
.mobile-top-bar {
    display: none;
    background: white;
    padding: 15px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 999;
    align-items: center;
    justify-content: space-between;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #334155;
    cursor: pointer;
    display: none;
}

.mobile-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-user i {
    font-size: 1.8rem;
    color: #3b82f6;
}

.mobile-user-info {
    text-align: right;
}

.mobile-user-info .name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #334155;
}

.mobile-user-info .type {
    font-size: 0.7rem;
    color: #64748b;
}

/* Header */
.header {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    padding: 20px 30px;
    border-radius: 16px;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}

.header h1 {
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.header h1 i {
    font-size: 1.8rem;
    color: rgba(255, 255, 255, 0.9);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 18px;
    border-radius: 40px;
}

.user-info i {
    font-size: 1.2rem;
}

/* Botões */
.btn {
    padding: 10px 22px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: #64748b;
    color: white;
}

.btn-secondary:hover {
    background: #475569;
    transform: translateY(-2px);
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 2px solid #3b82f6;
    color: #3b82f6;
}

.btn-outline:hover {
    background: #3b82f6;
    color: white;
}

.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.tab {
    padding: 10px 24px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    color: #475569;
    font-size: 0.9rem;
}

.tab:hover {
    border-color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

.tab.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Cards de Resumo */
.resumo-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.resumo-card {
    background: white;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    text-align: center;
    transition: all 0.3s;
    border: 1px solid #e2e8f0;
}

.resumo-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.resumo-card.receita {
    border-top: 4px solid #10b981;
}

.resumo-card.despesa {
    border-top: 4px solid #ef4444;
}

.resumo-card.saldo {
    border-top: 4px solid #3b82f6;
}

.resumo-card h3 {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.resumo-card .valor {
    font-size: 1.8rem;
    font-weight: 700;
}

.resumo-card .valor.positivo {
    color: #10b981;
}

.resumo-card .valor.negativo {
    color: #ef4444;
}

/* Período Info */
.periodo-info {
    background: white;
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    border-left: 4px solid #3b82f6;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.periodo-info i {
    color: #3b82f6;
    font-size: 1.3rem;
}

.periodo-info span {
    font-size: 1rem;
    font-weight: 500;
    color: #334155;
}

/* Tabelas */
.table-container {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 25px;
    border: 1px solid #e2e8f0;
}

.table-container table {
    width: 100%;
    border-collapse: collapse;
    min-width: 100%;
}

.table-container thead {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}

.table-container th {
    color: #475569;
    padding: 15px;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
}

.table-container td {
    padding: 12px 15px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    font-size: 0.9rem;
}

.table-container tbody tr:hover {
    background: #f8fafc;
}

.table-container tbody tr:last-child td {
    border-bottom: none;
}

/* Formulários */
.form-container {
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    max-width: 1000px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #334155;
    font-size: 0.85rem;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9rem;
    transition: all 0.3s;
    background: white;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

input.error,
select.error {
    border-color: #ef4444;
}

.help-text {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 5px;
}

/* Footer da Tabela */
.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 15px;
}

.record-info {
    color: #64748b;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.record-info i {
    color: #3b82f6;
}

.search-box {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-box input {
    width: 280px;
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
}

/* Paginação */
.pagination {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 20px 0;
}

.pagination .btn {
    min-width: 40px;
    padding: 8px;
    justify-content: center;
}

/* Filtros */
.filter-bar {
    background: white;
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.filter-group {
    flex: 1;
    min-width: 180px;
}

.filter-group label {
    font-size: 0.8rem;
    margin-bottom: 5px;
    color: #475569;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fed7aa;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Alertas */
.alert {
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.alert i {
    font-size: 1.2rem;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid #10b981;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

.alert-warning {
    background: #fed7aa;
    color: #92400e;
    border-left: 4px solid #f59e0b;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border-left: 4px solid #3b82f6;
}

/* Loading */
.loading {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(3px);
}

.loading.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Menu Cards */
.menu-item {
    text-align: center;
    padding: 20px;
    background: white;
    border-radius: 16px;
    text-decoration: none;
    color: #334155;
    transition: all 0.3s;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.menu-item:hover {
    background: #f8fafc;
    border-color: #3b82f6;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.15);
}

.menu-item i {
    font-size: 2rem;
    color: #3b82f6;
    transition: transform 0.3s;
}

.menu-item:hover i {
    transform: scale(1.1);
}

.menu-item span {
    font-weight: 600;
    font-size: 0.9rem;
}

/* Dashboard Cards */
.dashboard-card {
    background: white;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s;
    border: 1px solid #e2e8f0;
}

.dashboard-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.dashboard-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.dashboard-card .card-header h3 {
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 600;
}

.dashboard-card .card-header i {
    font-size: 1.8rem;
    opacity: 0.4;
    color: #3b82f6;
}

.dashboard-card .card-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 10px;
}

.dashboard-card .card-footer {
    border-top: 1px solid #e2e8f0;
    padding-top: 12px;
    margin-top: 12px;
    font-size: 0.8rem;
    color: #64748b;
}

/* Scrollbar Personalizada */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Animações */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fadeIn {
    animation: fadeIn 0.4s ease forwards;
}

/* Tooltips */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]:before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    background: #1e293b;
    color: white;
    border-radius: 8px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    pointer-events: none;
    z-index: 1000;
}

[data-tooltip]:hover:before {
    opacity: 1;
    visibility: visible;
    bottom: calc(100% + 8px);
}

/* ========================================
   RESPONSIVIDADE
   ======================================== */
@media (max-width: 1024px) {
    .container {
        padding: 15px;
    }

    .header {
        padding: 15px 20px;
    }

    .header h1 {
        font-size: 1.4rem;
    }
}

@media (max-width: 992px) {
    .app-sidebar {
        transform: translateX(-100%);
    }

    .app-sidebar.active {
        transform: translateX(0);
    }

    .app-main {
        margin-left: 0;
    }

    .mobile-top-bar {
        display: flex;
    }

    .menu-toggle {
        display: block;
    }
}

@media (max-width: 768px) {
    .app-main {
        padding: 15px;
    }

    .header {
        flex-direction: column;
        text-align: center;
        border-radius: 12px;
    }

    .header h1 {
        justify-content: center;
    }

    .user-info {
        width: 100%;
        justify-content: center;
    }

    .btn-group {
        justify-content: center;
        width: 100%;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .table-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        width: 100%;
    }

    .search-box input {
        width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .form-container {
        padding: 20px;
    }

    .resumo-cards {
        grid-template-columns: 1fr;
    }

    .tabs {
        flex-direction: column;
    }

    .tab {
        text-align: center;
    }

    .pagination {
        justify-content: center;
    }

    .filters-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.2rem;
    }

    .header h1 i {
        font-size: 1.3rem;
    }

    .periodo-info {
        flex-direction: column;
        text-align: center;
    }

    .record-info {
        flex-direction: column;
        text-align: center;
    }

    .dashboard-card .card-value {
        font-size: 1.4rem;
    }

    .resumo-card .valor {
        font-size: 1.4rem;
    }
}

/* ========================================
   IMPRESSÃO
   ======================================== */
@media print {

    .app-sidebar,
    .mobile-top-bar,
    .btn-group,
    .pagination,
    .table-footer,
    .search-box,
    .tabs,
    .filter-bar,
    .quick-actions-bar {
        display: none !important;
    }

    .app-main {
        margin: 0 !important;
        padding: 0 !important;
    }

    .container {
        padding: 0;
    }

    .table-container {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .table-container th {
        background: #f5f5f5 !important;
        color: #333 !important;
    }

    .print-header {
        display: block !important;
    }

    .print-footer {
        display: block !important;
    }
}

.print-header,
.print-footer {
    display: none;
}