* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #1a237e;
    --primary-light: #283593;
    --success: #2e7d32;
    --success-light: #e8f5e9;
    --danger: #c62828;
    --danger-light: #ffebee;
    --bg: #f0f2f5;
    --card-bg: #ffffff;
    --text: #333333;
    --text-light: #666666;
    --border: #e0e0e0;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ===== NAVIGATION ===== */
.nav-top {
    background: linear-gradient(135deg, #0d1b3e, #1a237e);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-logo {
    height: 30px;
    width: auto;
    border-radius: 4px;
}

.nav-title {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.3px;
}

.nav-links {
    display: flex;
    gap: 4px;
}

.nav-link {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link:hover {
    background: rgba(255,255,255,0.12);
    color: white;
}

.nav-link.active {
    background: rgba(255,255,255,0.18);
    color: white;
    font-weight: 600;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
}

.user-name {
    opacity: 0.9;
}

.btn-logout {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 6px 14px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.15);
    color: white;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px;
}

/* ===== FLASH MESSAGES ===== */
.flash {
    padding: 12px 18px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    font-weight: 500;
    border-left: 4px solid;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.flash-success {
    background: var(--success-light);
    color: var(--success);
    border-color: var(--success);
}

.flash-error {
    background: var(--danger-light);
    color: var(--danger);
    border-color: var(--danger);
}

.flash-info {
    background: #e3f2fd;
    color: #1565c0;
    border-color: #1565c0;
}

/* ===== PAGE HEADER ===== */
.page-header {
    margin-bottom: 20px;
}

.page-header h1 {
    font-size: 1.4rem;
    color: var(--primary);
    font-weight: 700;
}

.subtitle {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-top: 4px;
}

/* ===== CARDS ===== */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: #fafafa;
}

.card-body {
    padding: 24px;
}

/* ===== FORM SECTIONS ===== */
.form-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::before {
    content: '';
    display: block;
    width: 4px;
    height: 18px;
    background: var(--primary);
    border-radius: 2px;
}

/* ===== FORM ROWS ===== */
.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.form-row-4 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,35,126,0.1);
}

.form-control.highlight {
    border-color: var(--primary);
    font-weight: 600;
    font-size: 1rem;
    background: #f8f9ff;
}

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

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(26,35,126,0.3);
}

.btn-outline {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: #e8eaf6;
}

.btn-danger {
    background: white;
    color: var(--danger);
    border: 1.5px solid var(--danger);
}

.btn-danger:hover {
    background: var(--danger-light);
}

.btn-sm {
    padding: 5px 14px;
    font-size: 0.78rem;
    border-radius: 6px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ===== FILTER BAR ===== */
.filter-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.count-badge {
    background: #e8eaf6;
    color: var(--primary);
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ===== DATA TABLE ===== */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th {
    background: var(--primary);
    color: white;
    padding: 11px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table th:first-child {
    border-radius: 8px 0 0 0;
}

.data-table th:last-child {
    border-radius: 0 8px 0 0;
}

.data-table td {
    padding: 11px 14px;
    border-bottom: 1px solid #f0f0f0;
}

.data-table tr:hover td {
    background: #f8f8ff;
}

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

.amount-td {
    text-align: right;
    font-family: 'Courier New', monospace;
}

.neto-col {
    text-align: right;
}

.neto-valor {
    color: var(--success);
    font-size: 0.9rem;
}

.actions-col {
    display: flex;
    gap: 6px;
}

.periodo-badge {
    display: inline-block;
    background: var(--success-light);
    color: var(--success);
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 600;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #999;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.empty-state h3 {
    color: #666;
    margin-bottom: 6px;
    font-size: 1rem;
}

.empty-state p {
    font-size: 0.85rem;
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    color: var(--primary);
    font-size: 1.05rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-body {
    padding: 24px;
}

/* ===== FAB ===== */
.fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 1.5rem;
    font-weight: 300;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(26,35,126,0.4);
    transition: all 0.2s;
    z-index: 150;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(26,35,126,0.5);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .form-row-2, .form-row-3, .form-row-4 {
        grid-template-columns: 1fr;
    }

    .nav-top {
        flex-wrap: wrap;
        height: auto;
        padding: 10px;
        gap: 8px;
    }

    .nav-links {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .main-content {
        padding: 16px 10px;
    }

    .data-table {
        font-size: 0.75rem;
    }

    .actions-col {
        flex-direction: column;
    }
}
