* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body { background-color: #f4f7f6; color: #333; display: flex; flex-direction: column; align-items: center; min-height: 100vh; }
header { background-color: #0056b3; color: white; width: 100%; padding: 20px; text-align: center; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
main, section { width: 90%; max-width: 400px; margin-top: 20px; display: flex; flex-direction: column; gap: 15px; }

h2 { text-align: center; color: #0056b3; margin-bottom: 10px; display: flex; align-items: center; justify-content: center; position: relative;}
.btn-icon-left { position: absolute; left: 0; cursor: pointer; color: #6c757d; font-size: 24px; }
.btn-icon-left:active { color: #0056b3; }
/* NUEVO: Icono a la derecha para el historial en las categorías */
.btn-icon-right { position: absolute; right: 0; cursor: pointer; color: #17a2b8; font-size: 24px; }
.btn-icon-right:active { color: #117a8b; }

i { margin-right: 8px; }

button { border: none; border-radius: 8px; padding: 15px; font-size: 16px; font-weight: bold; cursor: pointer; transition: background-color 0.2s; width: 100%; display: flex; align-items: center; justify-content: center; }
.btn-main { background-color: #ffffff; color: #0056b3; border: 2px solid #0056b3; box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
.btn-main:active { background-color: #e6f0fa; }
.btn-balance { background-color: #28a745; color: white; border: none; }
.btn-balance:active { background-color: #218838; }

.btn-sub { background-color: #e0e0e0; color: #333; margin-bottom: 10px; justify-content: flex-start; padding-left: 20px; }
.sub-category { background-color: #ffffff; padding: 10px; border-radius: 8px; margin-bottom: 15px; border: 1px dashed #ccc; }
.sub-category button { background-color: #f0f0f0; margin-bottom: 5px; padding: 10px; font-size: 14px; font-weight: normal; }
.btn-back { background-color: #6c757d; color: white; margin-top: 20px; justify-content: center;}
.hidden { display: none !important; }

.date-filters { background: white; padding: 15px; border-radius: 8px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.date-filters input { padding: 8px; border: 1px solid #ccc; border-radius: 4px; width: 100%; font-family: inherit;}
.btn-filter { background-color: #ffc107; color: #333; padding: 10px; }

.balance-card { background: white; padding: 20px; border-radius: 10px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); font-size: 18px; line-height: 1.8; }
.color-green { color: #28a745; font-weight: bold; }
.color-red { color: #dc3545; font-weight: bold; }
.color-blue { color: #007bff; font-weight: bold; }

#modal-formulario, #modal-historial { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background: white; padding: 25px; border-radius: 12px; width: 90%; max-width: 350px; display: flex; flex-direction: column; gap: 15px; max-height: 90vh; }
.large-modal { max-width: 400px; overflow-y: auto; padding-top: 15px;}

.modal-content input, .modal-content select { padding: 12px; border: 1px solid #ccc; border-radius: 6px; font-size: 16px; width: 100%; font-family: inherit; background-color: white; }
.btn-save { background-color: #007bff; color: white; justify-content: center;}
.btn-cancel { background-color: #dc3545; color: white; padding: 10px; justify-content: center;}

.history-list { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; max-height: 60vh;}
.history-item { background: #f8f9fa; border: 1px solid #dee2e6; padding: 12px; border-radius: 8px; font-size: 14px;}
.history-item strong { display: block; color: #0056b3; font-size: 16px; margin-bottom: 5px;}
.history-item p { margin-bottom: 3px; }
.btn-edit { background-color: #28a745; color: white; padding: 8px; font-size: 14px; margin-top: 10px; }
.btn-delete { background-color: #dc3545; color: white; padding: 8px; font-size: 14px; margin-top: 10px; }
.inline-input { width: 100%; padding: 8px; margin-bottom: 8px; border: 1px solid #ccc; border-radius: 4px; font-size: 14px; font-family: inherit; background: white;}