body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-image: url('motorista.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    align-items: center;
    color: #333;
    line-height: 1.6;
}

.header-compact {
    background-color: #5DADE2;
    color: white;
    text-align: center;
    padding: 10px 0;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.header-compact-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 15px;
    flex-wrap: wrap;
}

.header-logo {
    max-width: 70px;
    height: auto;
    border-radius: 5px;
}

.header-compact-text h1 {
    color: white;
    margin: 0;
    font-size: 1.6em;
}

.header-compact-text p {
    color: #FFEB3B;
    margin: 0;
    font-size: 0.9em;
}

.content-wrapper {
    flex-grow: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    padding: 30px 15px;
    width: 100%;
    max-width: 1200px;
    box-sizing: border-box;
    gap: 30px;
}

.summary-section {
    width: 100%;
    background-color: rgba(255, 255, 255, 0.7);
    padding: 20px 0;
    text-align: center;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
    z-index: 1;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    margin-top: 20px;
}

.summary-section h2 {
    margin-top: 0;
    color: #0D47A1;
    margin-bottom: 20px;
}

.summary-cards {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    max-width: 1250px;
    margin: 0 auto;
    padding: 0 10px;
}

.card {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    flex: 1 1 170px;
    min-width: 160px; /* Aumentado um pouco para mais info */
    max-width: 230px;
    text-align: left;
    border-left: 5px solid;
}

.daily-summary { border-left-color: #4CAF50; }
.prev-month-summary { border-left-color: #FF9800; }
.current-month-summary { border-left-color: #FFC107; }
.prev-year-summary { border-left-color: #795548; }
.current-year-summary { border-left-color: #607D8B; }

.card h3 {
    margin-top: 0;
    color: #333;
    font-size: 1em;
    margin-bottom: 6px;
}

.card p {
    margin: 3px 0;
    font-size: 0.78em; /* Reduzido para caber mais info */
    color: #555;
}

.card span {
    font-weight: bold;
    color: #0D47A1;
}

.container {
    background-color: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    text-align: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #333;
    overflow: hidden;
}

.input-form-container {
    flex: 1 1 320px;
    min-width: 280px;
    max-width: 450px;
    order: 1;
}

.history-container {
    flex: 2 1 500px;
    min-width: 300px;
    max-width: 700px;
    display: flex;
    flex-direction: column;
    order: 2;
}

.container h2 {
    color: #0D47A1;
    margin-top: 0;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 15px;
    text-align: left;
}

label {
    display: block;
    font-weight: bold;
    margin-bottom: 6px;
    color: #333;
    font-size: 0.9em;
}

input[type="date"],
input[type="number"],
input[type="text"],
input[type="time"],
select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    font-size: 0.95em;
    background-color: rgba(255, 255, 255, 0.9);
}

.calculated-field span {
    display: inline-block;
    padding: 8px;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 5px;
    color: #495057;
    font-weight: bold;
}

button {
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.95em;
    transition: background-color 0.3s ease, opacity 0.2s ease;
    margin-top: 10px;
    display: inline-block;
    width: auto;
}

button:hover {
     opacity: 0.9;
}

.full-width-button {
    width: 100%;
    box-sizing: border-box;
}

.fueling-form-section,
.transaction-form-section {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.5);
}
.fueling-form-section h3,
.transaction-form-section h3 {
    color: #0D47A1;
    margin-top: 0;
    margin-bottom: 12px;
}

#add-fueling-btn { background-color: #4CAF50; }
#add-fueling-btn:hover { background-color: #388E3C; }
#add-other-transaction-btn { background-color: #FF9800; }
#add-other-transaction-btn:hover { background-color: #FB8C00; }

.history-container h2 { margin-bottom: 15px; }
.history-container h3 { color: #0D47A1; margin-top: 20px; margin-bottom: 8px; font-size: 1.05em; border-bottom: 1px solid #eee; padding-bottom: 4px; }

.filter-controls { margin-bottom: 15px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; }
.filter-controls label { font-weight: normal; margin-bottom: 0; margin-right: 5px; font-size: 0.9em;}
.filter-controls input[type="date"] { padding: 7px 10px; font-size: 0.85em; border-radius: 5px; border: 1px solid #ccc; background-color: rgba(255, 255, 255, 0.9); max-width: 150px; }
.filter-controls button { padding: 7px 10px; font-size: 0.85em; border-radius: 5px; border: 1px solid #4CAF50; cursor: pointer; background-color: #4CAF50; color: white; opacity: 1; transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease; margin-top:0; }
.filter-controls button:hover { background-color: #388E3C; border-color: #388E3C; opacity: 1; }
.filter-controls button#filter-all { background-color: #f0f0f0; color: #333; border-color: #ccc; }
.filter-controls button#filter-all:hover { background-color: #ddd; border-color: #bbb; }
.filter-controls .filter-period-btn { background-color: #5DADE2; border-color: #4a8db8;}
.filter-controls .filter-period-btn:hover { background-color: #4a8db8; }

.history-list-wrapper { max-height: 220px; overflow-y: auto; margin-bottom: 15px; border: 1px solid #ccc; border-radius: 5px; background-color: rgba(255, 255, 255, 0.8); flex-grow: 1; }
.history-list-wrapper.other-history { margin-top: 8px; }

#fueling-history-table,
#other-history-table { width: 100%; border-collapse: collapse; font-size: 0.85em; }

#fueling-history-table th, #fueling-history-table td,
#other-history-table th, #other-history-table td { border: 1px solid #ddd; padding: 6px; text-align: left; word-break: break-word; }

#fueling-history-table th, #other-history-table th { background-color: #f2f2f2; position: sticky; top: 0; z-index: 2; font-size: 0.9em; }

#fueling-history-table .col-data { width: 70px; min-width: 70px; }
#fueling-history-table .col-hora { width: 45px; min-width: 45px; }
#fueling-history-table .col-km { width: 60px; min-width: 60px; text-align: right; }
#fueling-history-table .col-comb { width: 60px; min-width: 55px; }
#fueling-history-table .col-vol { width: 55px; min-width: 45px; text-align: right;}
#fueling-history-table .col-unit { width: 55px; min-width: 45px; text-align: right;}
#fueling-history-table .col-total { width: 65px; min-width: 55px; text-align: right;}
#fueling-history-table .col-efic { width: 55px; min-width: 45px; text-align: center;}
#fueling-history-table .col-acoes-fuel { width: 65px; min-width: 65px; text-align: center; }

#other-history-table .col-data { width: 75px; min-width: 75px; }
#other-history-table .col-tipo { width: 35px; min-width: 35px; text-align: center;}
#other-history-table .col-categoria { width: auto; min-width: 130px; }
#other-history-table .col-valor { width: 80px; min-width: 70px; text-align: right; }
#other-history-table .col-acoes-other { width: 65px; min-width: 65px; text-align: center; }

#fueling-history-table tbody tr:nth-child(even),
#other-history-table tbody tr:nth-child(even) { background-color: rgba(249, 249, 249, 0.6); }
#fueling-history-table tbody tr:hover,
#other-history-table tbody tr:hover { background-color: rgba(240, 240, 240, 0.8); }

.actions-cell button,
.col-acoes-fuel button,
.col-acoes-other button { background: none; color: #333; border: none; padding: 4px; font-size: 0.9em; cursor: pointer; margin: 0 2px; transition: color 0.2s ease; display: inline-block; width: auto; margin-top: 0; }
.actions-cell button:hover,
.col-acoes-fuel button:hover,
.col-acoes-other button:hover { color: #0D47A1; opacity: 1; }
.actions-cell .edit-btn, .col-acoes-fuel .edit-btn, .col-acoes-other .edit-btn { color: #2196F3; }
.actions-cell .delete-btn, .col-acoes-fuel .delete-btn, .col-acoes-other .delete-btn { color: #F44336; }

.export-import-buttons { display: flex; justify-content: center; gap: 12px; margin-top: 15px; flex-wrap: wrap; }
.export-import-buttons button,
.export-import-buttons .import-button-label { flex: 1 1 auto; min-width: 130px; font-size: 0.9em; padding: 10px 15px;}
#export-pdf-btn { background-color: #E57373; }
#export-pdf-btn:hover { background-color: #EF5350; }
#export-csv-btn { background-color: #81C784; }
#export-csv-btn:hover { background-color: #66BB6A; }
.import-button-label { background-color: #64B5F6; color: white; border-radius: 5px; cursor: pointer; text-align: center; transition: background-color 0.3s ease; margin-top: 10px; }
.import-button-label:hover { background-color: #42A5F5; opacity: 0.9; }

.adsense-space { width: 100%; max-width: 970px; margin: 15px auto; padding: 8px; box-sizing: border-box; text-align: center; min-height: 70px; background-color: rgba(200, 200, 200, 0.1); border: 1px dashed #ccc; }
.adsense-space p { color: #999; font-style: italic; margin: 0; padding: 25px 0; }

.tool-footer { background-color: #424242; color: white; text-align: center; padding: 12px 0; width: 100%; margin-top: auto; box-sizing: border-box; }
.tool-footer-links a { color: #B0BEC5; text-decoration: none; margin: 0 8px; }
.tool-footer-links a:hover { text-decoration: underline; }
.tool-footer div { margin-top: 4px; font-size: 0.85em; color: #E0E0E0; }

.balance-positive { color: green; font-weight: bold; }
.balance-negative { color: red; font-weight: bold; }

.transaction-type-expense { color: #F44336; font-weight: bold; }
.transaction-type-income { color: #4CAF50; font-weight: bold; }

@media (max-width: 1200px) { /* Ajuste para quando 5 cards podem não caber bem */
    .summary-cards { max-width: 1000px; }
    .card { flex: 1 1 18%; } /* Tenta manter 5, mas permite quebrar para 4 ou 3 */
}


@media (max-width: 992px) {
    .content-wrapper {
        flex-direction: column;
        align-items: center;
    }
    .input-form-container, .history-container {
        flex-basis: auto;
        width: 95%;
        max-width: 650px;
        order: 0;
    }
    .summary-cards { max-width: 700px; }
    .card { flex: 1 1 30%; } /* Tenta 3 por linha */
}

@media (max-width: 768px) {
    .header-compact-content, .filter-controls { flex-direction: column; gap: 12px; }
    .summary-cards { flex-direction: column; align-items: center; gap: 10px; }
    .card { flex: 1 1 90%; max-width: 350px; }

    .content-wrapper { padding: 20px 10px; }
    .container, .history-container { flex: 1 1 100%; padding: 20px; max-width: 100%; width: 100%; }
    .history-list-wrapper { max-height: 250px; }
    button { padding: 10px 15px; font-size: 0.9em; }
    .full-width-button, .standard-button { padding: 10px 18px; }
    .actions-cell button, .col-acoes-fuel button, .col-acoes-other button { padding: 3px 5px; font-size: 0.8em; }
    .export-import-buttons { flex-direction: column; align-items: stretch;}
    .export-import-buttons button, .export-import-buttons .import-button-label { min-width: unset; }
    .filter-controls input[type="date"] { width: 100%; max-width: none;}
}

@media (max-width: 520px) { /* Ajuste para 2 cards por linha em telas menores */
    .card { flex: 1 1 45%; max-width: none; }
    .summary-cards { max-width: none; }
}


@media (max-width: 400px) { /* Cards um abaixo do outro em telas muito pequenas */
    .card { flex: 1 1 90%; }
    .card p { font-size: 0.75em; }
    .card h3 { font-size: 0.95em; }
    .filter-controls button { width: 100%; }
}