/* Estilo general */
:root { --primary-color: #e74c3c; --secondary-color: #3498db; --dark-color: #2c3e50; --light-gray: #f8f9fa; --border-color: #e9ecef; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background-color: #f0f2f5; margin: 0; padding: 20px; color: #333; }
.container { max-width: 1200px; margin: 20px auto; background-color: #ffffff; padding: 25px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08); }
h1, h2, h3, h4 { color: var(--dark-color); }
h1 { border-bottom: 2px solid var(--primary-color); padding-bottom: 10px; margin-top: 0; }
h2 { margin-top: 0; padding-bottom: 8px; font-size: 1.5em; }
h3 { font-size: 1.2em; }
h4 { font-size: 1em; margin-top: 0; margin-bottom: 10px; color: #555; }
hr { border: 0; height: 1px; background-color: var(--border-color); margin: 30px 0; }
/* Formularios */
.form-container { max-width: 450px; margin: 20px auto; }
form label { margin-bottom: 8px; font-weight: 600; font-size: 14px; }
input[type="text"], input[type="password"], input[type="number"], select, textarea { padding: 10px; border: 1px solid #ccc; border-radius: 5px; margin-bottom: 15px; font-size: 16px; width: 100%; box-sizing: border-box; }
.inline-form { display: flex; flex-direction: row; gap: 10px; align-items: center; }
.inline-form input { margin-bottom: 0; }
button, .button { background-color: var(--primary-color); color: white; padding: 10px 16px; border: none; border-radius: 5px; font-size: 1em; font-weight: bold; cursor: pointer; transition: background-color 0.3s; text-align: center; text-decoration: none; display: inline-block; }
button:hover, .button:hover { background-color: #c0392b; }
button:disabled, .button-disabled { background-color: #bdc3c7 !important; cursor: not-allowed !important; color: #7f8c8d; }
.secondary { background-color: var(--secondary-color); }
.secondary:hover { background-color: #2980b9; }
/* Header */
.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 15px; }
.header-info span { font-weight: bold; color: var(--primary-color); }
.logout-btn, .nav-link { text-decoration: none; background-color: var(--secondary-color); color: white; padding: 10px 15px; border-radius: 5px; font-size: 14px; font-weight: bold; }
/* Tablas */
.table-container { overflow-x: auto; width: 100%; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; }
th, td { padding: 12px 15px; text-align: left; border-bottom: 1px solid var(--border-color); word-break: break-word; }
th { background-color: #34495e; color: white; }
td b { color: var(--dark-color); }
td.actions { text-align: right; white-space: nowrap;}
/* Mensajes */
.message { padding: 15px; margin-bottom: 20px; border-radius: 5px; font-weight: 500; border: 1px solid transparent; }
.message.success { background-color: #d4edda; color: #155724; border-color: #c3e6cb; }
.message.error { background-color: #f8d7da; color: #721c24; border-color: #f5c6cb; }
.message.info { background-color: #d1ecf1; color: #0c5460; border-color: #bee5eb; }
i { margin-right: 8px; }
/* Pestañas */
.tab-buttons { display: flex; border-bottom: 2px solid var(--border-color); margin-bottom: 20px; }
.tab-button { background: none; border: none; padding: 15px 20px; font-size: 1em; font-weight: 600; cursor: pointer; color: #555; position: relative; top: 2px; }
.tab-button.active { color: var(--primary-color); border-bottom: 2px solid var(--primary-color); }
.tab-content .tab-pane { display: none; animation: fadeIn 0.5s; }
.tab-content .tab-pane.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* KPIs */
.kpi-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-top: 10px; }
.kpi-card { background-color: var(--light-gray); padding: 20px; border-radius: 8px; text-align: center; }
.kpi-card h4 { margin-top: 0; font-size: 1em; color: #555; }
.kpi-card p { font-size: 2em; font-weight: bold; margin: 0; color: var(--dark-color); }
.kpi-card.profit p { color: #27ae60; }
.kpi-card.loss p { color: var(--primary-color); }

/* SECCIÓN FINANCIERA */
.financial-container { display: flex; flex-wrap: wrap; gap: 30px; }
.financial-main { flex: 2; min-width: 400px; }
.financial-summary-panel { flex: 1; min-width: 300px; background-color: var(--light-gray); padding: 20px; border-radius: 8px; border: 1px solid var(--border-color); align-self: flex-start; }
.financial-summary-panel h3 { margin-top: 0; border-bottom: 1px solid #ddd; padding-bottom: 10px; }
.form-section { margin-bottom: 30px; }
.summary-item { display: flex; justify-content: space-between; font-size: 1em; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px dashed #ddd; }
.summary-item:last-child { border-bottom: none; }
.summary-item span { color: #555; }
.summary-item strong { font-size: 1.1em; }
.net-profit-item strong { font-size: 1.4em; }
.profit { color: #27ae60; }
.loss { color: var(--primary-color); }
/* Lista de gastos */
.expense-list { list-style: none; padding: 0; margin: 0; border: 1px solid var(--border-color); border-radius: 5px; max-height: 200px; overflow-y: auto; }
.expense-list li { display: flex; justify-content: space-between; align-items: center; padding: 10px; border-bottom: 1px solid var(--border-color); }
.expense-list li:last-child { border-bottom: none; }
.expense-list li:hover { background-color: #fdfdfd; }
.expense-actions, .actions { display: flex; gap: 5px; align-items: center; }
.action-btn-small { background: none; border: none; cursor: pointer; padding: 5px; font-size: 14px; color: #777; }
.action-btn-small.edit-expense-type, .action-btn-small.edit-roll-btn, .action-btn-small.edit-log-btn { color: #2980b9; }
.action-btn-small.delete-expense-type, .action-btn-small.delete-roll-btn, .action-btn-small.delete-log-btn { color: var(--primary-color); }
.action-btn-small:hover { color: var(--dark-color); }
.action-btn-small-danger { background: none; border: none; color: #c0392b; font-size: 14px; padding: 5px; cursor: pointer; }

/* SECCIÓN STOCK */
.stock-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 30px; }
.stock-section { background-color: var(--light-gray); padding: 20px; border-radius: 8px; }

/* MODAL */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.6); }
.modal-content { background-color: #fefefe; margin: 15% auto; padding: 25px; border: 1px solid #888; width: 90%; max-width: 500px; border-radius: 8px; position: relative; box-shadow: 0 5px 15px rgba(0,0,0,0.3); animation: fadeIn 0.3s; }
.close-modal { color: #aaa; float: right; font-size: 28px; font-weight: bold; position: absolute; top: 10px; right: 20px; }
.close-modal:hover, .close-modal:focus { color: black; text-decoration: none; cursor: pointer; }
.modal-actions { text-align: right; margin-top: 20px; }
.modal-warning { font-size: 12px; color: #777; margin-top: 20px; padding-top: 10px; border-top: 1px solid #eee; }
.modal-warning b { color: var(--dark-color); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }

/* Botones y paginación */
.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border-color); }
.pagination .button, .pagination .button-disabled { padding: 8px 16px; font-size: 14px; }