/* ====== Estilos Institucionales ====== */
body {
    font-family: 'Segoe UI', sans-serif;
    background: #f9fafc;
    margin: 0;
    padding: 0; /* ← CORREGIDO */
    color: #2c3e50;
}

/* Contenedor principal */
.main-content {
    margin-left: 240px;
    padding: 40px;
}

/* Sidebar base */
.sidebar {
    width: 220px;
    background: #f5f7fa;
    position: fixed;
    top: 60px;
    left: 0;
    bottom: 0;
    padding: 20px 0;
    border-right: 1px solid #dcdcdc;
    transition: all 0.3s ease;
    z-index: 1000;
}

.sidebar h2 {
    text-align: center;
    color: #003366;
    margin-bottom: 20px;
    font-size: 20px;
}

/* Enlaces */
.sidebar a {
    display: block;
    padding: 12px 20px;
    color: #003366;
    text-decoration: none;
    font-size: 15px;
    transition: all 0.2s ease;
}

/* Iconos */
.sidebar a i {
    margin-right: 10px;
    color: #003366;
}

/* Hover institucional */
.sidebar a:hover {
    background: #e6eef7;
    color: #003366;
    font-weight: bold;
}

.sidebar a:hover i {
    color: #4CAF50;
}

/* Sección activa */
.sidebar a.active {
    background: #003366;
    color: #fff !important;
    font-weight: bold;
}

.sidebar a.active i {
    color: #4CAF50;
}

.tarjeta-porcion {
    background: #fff;
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
    max-width: 420px;
    margin-top: 20px;
}

.tarjeta-porcion h2 {
    margin: 0;
    color: #003366;
    font-size: 24px;
}

.tarjeta-porcion .grupo {
    color: #7f8c8d;
    margin-bottom: 15px;
}

.tarjetas-dieta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.tarjeta-porcion {
    background: #fff;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    width: 260px;
}

.tarjeta-porcion h3 {
    margin: 0;
    color: #003366;
}

.tarjeta-porcion .grupo {
    color: #7f8c8d;
    margin-bottom: 10px;
}

.macros {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.macro {
    text-align: center;
}

.macro .titulo {
    font-weight: bold;
}

.kcal {
    font-size: 18px;
    color: #003366;
    margin-bottom: 10px;
}

.porcion {
    color: #2c3e50;
}
.resumen-grid {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.resumen-card {
    background: #fff;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    width: 220px;
    text-align: center;
}

.resumen-card h3 {
    margin: 0;
    color: #003366;
}

.resumen-card p {
    margin: 5px 0;
}

.resumen-card.total {
    background: #003366;
    color: #fff;
}
.macros {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.macro {
    text-align: center;
    width: 30%;
}

.macro .titulo {
    display: block;
    font-weight: bold;
    color: #2c3e50;
}

.macro .valor {
    display: block;
    font-size: 18px;
    margin-top: 5px;
}

.macro .porcentaje {
    display: block;
    margin-top: 5px;
    color: #0078D7;
    font-weight: bold;
}

.kcal {
    font-size: 22px;
    color: #003366;
    margin-bottom: 10px;
}

.porcion {
    color: #2c3e50;
}
.porcion-card {
    background: #fff;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    max-width: 350px;
}

.porcion-card h3 {
    margin-top: 0;
    color: #003366;
}

.porcion-card .macro {
    margin: 8px 0;
    color: #2c3e50;
}

.porcion-card .kcal {
    margin-top: 12px;
    font-weight: bold;
    color: #0078D7;
}

/* Tarjetas */
.card, .form-card {
    background: #fff;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    margin-bottom: 30px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* Títulos */
h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 24px;
}

/* Formularios */
label {
    display: block;
    margin-bottom: 6px;
    color: #34495e;
    font-weight: 500;
}

input, select {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

input:focus, select:focus {
    border-color: #0078D7;
    outline: none;
}

/* Botones */
.btn {
    display: inline-block;
    padding: 10px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.3s;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: #0078D7;
    color: #fff;
}

.btn-primary:hover {
    background: #005a9e;
}

.btn-edit {
    background: #5bc0de;
    color: #fff;
}

.btn-edit:hover {
    background: #31b0d5;
}

.btn-delete {
    background: #e74c3c;
    color: #fff;
}

.btn-delete:hover {
    background: #c0392b;
}

/* Tablas */
table {
    width: 100%;
    margin: auto;
    border-collapse: collapse;
}

th, td {
    padding: 14px;
    text-align: left;
}

th {
    background: #0078D7;
    color: #fff;
    font-weight: 600;
}

tr:nth-child(even) {
    background: #f2f6fa;
}

.acciones {
    text-align: center;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    margin: 0 5px;
}

.icon-edit {
    color: #5bc0de;
}

.icon-delete {
    color: #e74c3c;
}

.icon-btn:hover {
    opacity: 0.7;
}

/* Mensajes */
.mensaje {
    margin: 20px 0;
    text-align: center;
    font-weight: bold;
    color: #27ae60;
}

.mensaje.error {
    color: #e74c3c;
}

/* Carbohidratos */
.macro-carbs {
    background: #E3F2FD;
    border-left: 4px solid #1A73E8;
    padding: 6px;
    border-radius: 4px;
}

/* Proteínas */
.macro-prot {
    background: #E8F5E9;
    border-left: 4px solid #43A047;
    padding: 6px;
    border-radius: 4px;
}

/* Grasas */
.macro-grasas {
    background: #FFF8E1;
    border-left: 4px solid #FBC02D;
    padding: 6px;
    border-radius: 4px;
}