/* =========================================================
   GLUCAPP — New Design System
   Aesthetic: Medical-grade minimalism · Clean · Trustworthy
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&family=DM+Mono:wght@400;500&display=swap');

/* ---- Design Tokens ---- */
:root {
    /* Core palette */
    --c-teal-900:  #0d4a50;
    --c-teal-700:  #1a6b72;
    --c-teal-500:  #20919a;
    --c-teal-300:  #6ec6cc;
    --c-teal-100:  #e3f5f6;
    --c-teal-50:   #f0fafa;

    --c-amber-500: #f0a500;
    --c-amber-400: #f7bc3a;
    --c-amber-200: #fde9a8;
    --c-amber-100: #fff8e6;

    --c-red-500:   #d94f4f;
    --c-red-100:   #fde8e8;

    --c-green-500: #3aaa6e;
    --c-green-100: #e4f5ec;

    --c-neutral-900: #131c1e;
    --c-neutral-700: #2e3d40;
    --c-neutral-500: #5c7074;
    --c-neutral-300: #a8bbbe;
    --c-neutral-100: #e8eeef;
    --c-neutral-50:  #f5f8f9;
    --c-white:       #ffffff;

    /*#f5f8f9  #f0f8f1*/

    /* Semantic roles */
    --color-primary:         var(--c-teal-700);
    --color-secondary:       var(--c-teal-500);
    --color-accent:          var(--c-amber-500);
    --color-text:            var(--c-neutral-900);
    --color-text-muted:      var(--c-neutral-500);
    --color-background:      var(--c-neutral-50);
    --color-surface:         var(--c-white);
    --color-input-border:    var(--c-neutral-100);
    --color-input-focus:     var(--c-teal-500);
    --color-danger:          var(--c-red-500);
    --color-success:         var(--c-green-500);

    /* Spacing */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-8: 32px;
    --sp-10: 40px;

    /* Radius */
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 16px;
    --r-xl: 24px;
    --r-pill: 999px;

    /* Shadow */
    --shadow-xs: 0 1px 3px rgba(19, 28, 30, 0.06);
    --shadow-sm: 0 2px 8px rgba(19, 28, 30, 0.08);
    --shadow-md: 0 4px 16px rgba(19, 28, 30, 0.10);
    --shadow-lg: 0 8px 32px rgba(19, 28, 30, 0.14);

    /* Animation */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --dur-fast: 150ms;
    --dur-mid: 240ms;
    --dur-slow: 400ms;

    /* Legacy compat aliases */
    --color-highlight: var(--c-teal-300);
    --color-button-disabled: var(--c-neutral-100);
    --color-text-disabled: var(--c-neutral-300);
    --color-green-light: var(--c-green-100);
    --color-orange-light: var(--c-amber-100);
    --color-red-light: var(--c-red-100);
    --color-green-dark: var(--c-green-500);
    --color-orange-dark: var(--c-amber-400);
    --color-red-dark: var(--c-red-500);
}

/* =========================================================
   BASE
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
}

body {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    color: var(--color-text);
    background-color: var(--color-background);
    background-color: #f2f2f2;
    max-width: 700px;
    margin: 0 auto;
    padding: 20px 20px 0;
    padding-top: 76px; /* header height + gap */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Hide number spinners */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* =========================================================
   TYPOGRAPHY
   ========================================================= */

h1 {
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--c-white);
    margin: 0;
}

h2 {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--color-text);
    margin: 0 0 var(--sp-4);
}

h3 {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin: 0 0 var(--sp-2);
}

label {
    display: block;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--color-text-muted);
    margin-bottom: var(--sp-1);
    letter-spacing: 0.02em;
}

/* =========================================================
   INPUTS
   ========================================================= */

input {
    width: calc(100% - 0px);
    padding: 9px 12px;
    border: 1.5px solid var(--color-input-border);
    border-color: #d4d4d4;
    border-radius: var(--r-md);
    font-size: 14px;
    font-family: inherit;
    color: var(--color-text);
    background-color: var(--c-white);
    transition: border-color var(--dur-fast) var(--ease-in-out),
                box-shadow var(--dur-fast) var(--ease-in-out);
    -webkit-appearance: none;
}

input:focus {
    outline: none;
    border-color: var(--color-input-focus);
    box-shadow: 0 0 0 3px rgba(32, 145, 154, 0.15);
}

input::placeholder {
    color: var(--c-neutral-300);
    font-style: normal;
}

input[type="number"] {
    font-family: 'DM Mono', monospace;
    font-size: 15px;
}

.input-bloqueado {
    background-color: var(--c-neutral-50);
    color: var(--color-text-muted);
    pointer-events: none;
    border-color: transparent;
}

/* =========================================================
   HEADER
   ========================================================= */

#header {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--c-teal-900);
    padding: 0 20px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 60px;
    gap: 10px;
}

#logo {
    height: 36px;
    width: auto;
    margin-left: 48px;
    display: block;
}

.logo-title-container {
    display: flex;
    align-items: center;
}

/* Hamburger */
#menuButton {
    position: fixed;
    top: 18px;
    left: 20px;
    cursor: pointer;
    z-index: 1002;
    transition: opacity var(--dur-mid) var(--ease-out),
                transform var(--dur-mid) var(--ease-out);
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 4px;
}

#menuButton.hidden {
    opacity: 0;
    transform: translateY(-100%);
    pointer-events: none;
}

.menu-line {
    width: 22px;
    height: 2px;
    background-color: rgba(255,255,255,0.85);
    border-radius: 2px;
    transition: background-color var(--dur-fast);
}

#menuButton:hover .menu-line {
    background-color: var(--c-white);
}

/* =========================================================
   SIDE MENU
   ========================================================= */

#sideMenu {
    height: 100%;
    width: 0;
    position: fixed;
    z-index: 1001;
    top: 0;
    left: 0;
    background-color: var(--c-white);
    overflow-x: hidden;
    transition: width 0.2s var(--ease-out);
    padding-top: 0;
    white-space: nowrap;
    box-shadow: 4px 0 24px rgba(0,0,0,0.08);
}

.menu-header {
    display: flex;
    align-items: center;
    padding: var(--sp-5) var(--sp-5) var(--sp-4);
    border-bottom: 1.5px solid var(--c-neutral-100);
    background: var(--c-teal-900);
    min-height: 60px;
}

.menu-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--c-white);
    flex-grow: 1;
}

.close-menu-btn {
    font-size: 22px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    padding: 0;
    margin-right: var(--sp-4);
    line-height: 1;
    transition: color var(--dur-fast);
}

.close-menu-btn:hover {
    color: var(--c-white);
    background: none;
}

#sideMenu a {
    padding: 14px var(--sp-6);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    color: var(--c-neutral-700);
    display: block;
    transition: color var(--dur-fast), background-color var(--dur-fast);
    border-left: 3px solid transparent;
}

#sideMenu a:hover {
    color: var(--color-primary);
    background-color: var(--c-teal-50);
    border-left-color: var(--c-teal-500);
}

#sideMenu .menu-title {
    border-bottom: none;
}

/* =========================================================
   SETTINGS ROW
   ========================================================= */

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--sp-5);
    margin-bottom: var(--sp-6);
    width: 100%;
}

.settings-left {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

/* =========================================================
   BUTTONS — Sistema unificado
   ========================================================= */

button {
    padding: 8px 16px;
    background-color: var(--color-primary);
    color: var(--c-white);
    border: none;
    border-radius: var(--r-pill);
    cursor: pointer;
    font-size: 13.5px;
    font-family: 'DM Sans', inherit;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: background-color var(--dur-fast) var(--ease-in-out),
                transform var(--dur-fast) var(--ease-in-out),
                box-shadow var(--dur-fast) var(--ease-in-out);
    -webkit-tap-highlight-color: transparent;
}

button:hover {
    background-color: var(--c-teal-500);
}

button:active {
    transform: scale(0.97);
}

/* .boton-3d — principal pill button */
.boton-3d {
    background: var(--color-primary);
    border: none;
    border-radius: var(--r-pill);
    padding: 9px 16px;
    color: var(--c-white);
    font-size: 13px;
    font-weight: 500;
    font-family: 'DM Sans', inherit;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: background-color var(--dur-fast) var(--ease-in-out),
                box-shadow var(--dur-fast) var(--ease-in-out),
                transform var(--dur-fast) var(--ease-in-out);
}

.boton-3d:hover {
    background: var(--c-teal-500);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.boton-3d:active {
    transform: translateY(0) scale(0.97);
    box-shadow: var(--shadow-xs);
}

.boton-3d:disabled {
    background: var(--color-button-disabled);
    color: var(--color-text-disabled);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Specific buttons */
#btnRacion.boton-3d {
    background: var(--c-amber-100);
    color: var(--c-neutral-700);
    border: 1.5px solid var(--c-amber-400);
    font-weight: 500;
}

#btnRacion.boton-3d:hover {
    background: var(--c-amber-200);
}

#btnRatio.boton-3d {
    background: var(--c-amber-100);
    color: var(--c-neutral-700);
    border: 1.5px solid var(--c-amber-400);
    font-weight: 500;
}

#btnRatio.boton-3d:hover {
    background: var(--c-amber-200);
}

#btnReset.boton-3d {
    background: var(--c-red-100);
    color: var(--c-red-500);
    border: 1.5px solid var(--c-red-500);
}

#btnReset.boton-3d:hover {
    background: var(--c-red-500);
    color: var(--c-white);
}

#btnReset, button#btnAñadir {
    margin-right: 0;
}

/* Add food button */
#btnAñadir {
    background: var(--color-primary);
    border-radius: var(--r-pill);
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    letter-spacing: 0.01em;
}

#btnAñadir:hover {
    background: var(--c-teal-500);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* Region buttons */
.region-buttons {
    display: flex;
    justify-content: center;
    gap: var(--sp-3);
    margin-bottom: var(--sp-5);
    margin-top: 10px;
}

.btn-region {
    flex: 1;
    max-width: 200px;
    padding: 10px var(--sp-4);
    border: 1.5px solid var(--c-neutral-100);
    border-radius: var(--r-md);
    cursor: pointer;
    font-family: 'DM Sans', inherit;
    font-size: 13.5px;
    font-weight: 500;
    transition: all var(--dur-fast) var(--ease-in-out);
    text-align: center;
    background: var(--c-neutral-50);
    color: var(--color-text-muted);
}

.btn-region.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--c-white);
}

.btn-region:not(.active):hover {
    border-color: var(--c-teal-300);
    color: var(--color-primary);
}

.btn-aceptar {
    margin-top: var(--sp-5);
    padding: 10px var(--sp-6);
    background: var(--color-primary);
    color: var(--c-white);
    border: none;
    border-radius: var(--r-pill);
    font-family: 'DM Sans', inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--dur-fast);
}

.btn-aceptar:hover { background: var(--c-teal-500); }

.btn-aceptar:disabled {
    background: var(--c-neutral-100);
    color: var(--color-text-muted);
    cursor: not-allowed;
}

/* Adjust +/- buttons */
.botones-ajuste {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: var(--sp-1);
}

.botones-ajuste button {
    width: 32px;
    height: 32px;
    background: var(--c-amber-100);
    color: var(--c-neutral-700);
    border: 1.5px solid var(--c-amber-400);
    border-radius: 50%;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    cursor: pointer;
    transition: background-color var(--dur-fast), transform var(--dur-fast);
}

.botones-ajuste button:hover {
    background: var(--c-amber-200);
    transform: scale(1.08);
}

.botones-ajuste button:disabled {
    background: var(--c-neutral-50);
    border-color: var(--c-neutral-100);
    color: var(--c-neutral-300);
    cursor: not-allowed;
    transform: none;
}

.botones-ajuste-ratio {
    display: flex;
    justify-content: space-between;
    width: 60px;
    margin-top: 5px;
    margin-left: 13px;
    gap: 14px;
}

.botones-ajuste-ratio button {
    width: 28px;
    height: 28px;
    background: var(--c-amber-100);
    color: var(--c-neutral-700);
    border: 1.5px solid var(--c-amber-400);
    border-radius: 50%;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.botones-ajuste-ratio button:hover {
    background: var(--c-amber-200);
}

/* boton-mas / boton-menos */
.boton-mas, .boton-menos {
    width: 32px;
    height: 32px;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border-radius: 50%;
    transition: all var(--dur-fast) var(--ease-in-out);
    padding: 0;
    font-family: 'DM Sans', sans-serif;
}

.boton-mas:disabled, .boton-menos:disabled {
    background: var(--c-neutral-50) !important;
    border-color: var(--c-neutral-100) !important;
    color: var(--c-neutral-300) !important;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* =========================================================
   FOOD CARDS
   ========================================================= */

.alimento {
    background: var(--color-surface);
    border-radius: var(--r-lg);
    padding: 0;
    margin-bottom: var(--sp-4);
    box-shadow: var(--shadow-xs);
    border: 1.5px solid var(--c-neutral-100);
    /* border-color: var(--c-neutral-300); */
    transition: box-shadow var(--dur-mid) var(--ease-out),
                border-color var(--dur-mid) var(--ease-out),
                transform var(--dur-fast) var(--ease-out);
    position: relative;
    width: 100%;
    animation: card-in var(--dur-slow) var(--ease-out) both;
    overflow: hidden;
}

@keyframes card-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alimento:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--c-neutral-300);
    border-width: 2.5px;
}

/* Status stripe */
.franja-estado {
    height: 4px;
    width: calc(100% + 3px);
    left: -1.5px;
    position: relative;
    transition: background-color var(--dur-mid) var(--ease-in-out);
    border-radius: var(--r-pill);
    background-color: var(--c-red-500);
    margin-bottom: var(--sp-4);
    margin-top: -4px;
    opacity: 0.7;
}

.franja-verde {
    background-color: var(--c-green-500);
}

/* Card header */
.alimento-header {
    display: flex;
    align-items: center;
    margin-bottom: var(--sp-4);
    gap: var(--sp-2);
}

.alimento-header h3 {
    flex-shrink: 0;
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
}

.alimento-header h3.tooltip {
    margin: 0;
}

/* Card grid */
.container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--sp-4);
}

.block {
    width: calc(50% - var(--sp-2));
    min-width: 140px;
    
}

.block label:not(:first-child) {
    margin-top: 10px; /* era 5px, subir a 10px */
}

/* Input wrappers */
.input-wrapper {
    position: relative;
    display: block;
    width: 100%;
}

.input-reducido {
    width: 100%;
    display: block;
    box-sizing: border-box;
}

.botones-container {
    display: flex;
    align-items: center;
    margin-left: var(--sp-3);
    flex-shrink: 0;
}

/* Food name input */
.nombre-alimento {
    padding-right: 32px;
    box-sizing: border-box;
    font-weight: 500;
    font-size: 14px;
}

/* Clear input button */
.limpiar-input-alimento {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    display: none;
    color: var(--c-neutral-300);
    font-size: 16px;
    padding: 2px;
    background: none;
    border: none;
    line-height: 1;
    z-index: 2;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    align-items: center;
    justify-content: center;
    transition: color var(--dur-fast), background-color var(--dur-fast);
}

.limpiar-input-alimento:hover {
    color: var(--c-neutral-700);
    background: var(--c-neutral-100);
}

/* Close card button */
.close-btn-tarjeta {
    flex-shrink: 0;
    background: var(--c-red-100);
    border: none;
    color: var(--c-red-500);
    font-size: 16px;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    border-radius: 50%;
    transition: background-color var(--dur-fast), transform var(--dur-fast);
    margin-left: auto;
}

.close-btn-tarjeta:hover {
    background-color: var(--c-red-500);
    color: var(--c-white);
    transform: scale(1.1);
}

.close-btn-tarjeta:active {
    transform: scale(0.93);
}

/* Orange accent for intake side */
.orange-text {
    color: var(--c-amber-500) !important;
}

.orange-border {
    border-color: var(--c-amber-400) !important;
}

.orange-border:focus {
    border-color: var(--c-amber-500) !important;
    box-shadow: 0 0 0 3px rgba(240, 165, 0, 0.15) !important;
}

/* "Ración" inline box */
.racion-box {
    background: var(--c-amber-100);
    border: 1.5px solid var(--c-amber-400);
    color: var(--c-neutral-700);
    padding: 5px 10px;
    border-radius: var(--r-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: 'DM Mono', monospace;
    transition: background-color var(--dur-fast);
    display: inline-block;
}

.racion-box:hover {
    background: var(--c-amber-200);
}

/* =========================================================
   TOTALS PANEL
   ========================================================= */

#totalesGenerales {
    background: var(--c-white);
    border: 1.5px solid var(--c-neutral-100);
    border-radius: var(--r-lg);
    padding: var(--sp-5) var(--sp-6);
    margin-top: var(--sp-4);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--sp-8);
}

.totales-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.total-chip {
    background: var(--c-teal-50);
    border: 1.5px solid var(--c-teal-100);
    border-radius: var(--r-md);
    padding: 12px 8px 10px;
    text-align: center;
}

.total-chip .valor {
    display: block;
    font-size: 1.65rem;
    font-weight: 700;
    font-family: 'DM Mono', monospace;
    color: var(--c-teal-900);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.total-chip .etiqueta {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-top: 5px;
}

#notaInsulinaOrientativa {
    font-size: 13px;
    color: var(--color-text-muted);
    font-style: normal;
    font-weight: 400;
    border-top: 1.5px solid var(--c-neutral-100);
    padding-top: 12px;
    margin-top: 0;
    line-height: 1.5;
}

/* =========================================================
   AUTOCOMPLETE
   ========================================================= */

.autocomplete-items {
    position: absolute;
    border: 1.5px solid var(--c-neutral-100);
    border-top: none;
    z-index: 99;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
    background-color: var(--c-white);
    box-sizing: border-box;
    display: none;
    border-radius: 0 0 var(--r-md) var(--r-md);
}

.autocomplete-items:empty {
    border: none;
    box-shadow: none;
}

.autocomplete-items div {
    padding: 10px 14px;
    cursor: pointer;
    background-color: var(--c-white);
    border-bottom: 1px solid var(--c-neutral-50);
    line-height: 1.4;
    font-size: 14px;
    transition: background-color var(--dur-fast);
}

.autocomplete-items div:hover,
.autocomplete-items div.autocomplete-active {
    background-color: var(--c-teal-50);
    color: var(--color-primary);
}

/* =========================================================
   TOOLTIPS
   ========================================================= */

.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: var(--c-neutral-900);
    color: var(--c-white);
    text-align: center;
    border-radius: var(--r-md);
    padding: 8px 12px;
    position: absolute;
    z-index: 10;
    bottom: 130%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity var(--dur-mid) var(--ease-out);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: 0;
    text-transform: none;
    pointer-events: none;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

.disabled-tooltip {
    position: relative;
    cursor: not-allowed;
}

.disabled-tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: var(--c-neutral-900);
    color: var(--c-white);
    text-align: center;
    border-radius: var(--r-md);
    padding: 8px 12px;
    position: absolute;
    z-index: 10;
    bottom: 130%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity var(--dur-mid);
    font-size: 12px;
    pointer-events: none;
}

.disabled-tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Info button */
.info-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: var(--c-teal-100);
    color: var(--color-primary);
    border: none;
    border-radius: 50%;
    font-size: 11px;
    cursor: pointer;
    margin-left: 4px;
    padding: 0;
    font-family: 'DM Mono', monospace;
    vertical-align: super;
    font-weight: 600;
    transition: background-color var(--dur-fast);
}

.info-button:hover {
    background: var(--c-teal-300);
    color: var(--c-white);
}

/* Alert box */
.alerta-amarilla {
    background: var(--c-amber-100);
    border: 1.5px solid var(--c-amber-400);
    padding: var(--sp-4);
    border-radius: var(--r-md);
    color: var(--c-neutral-700);
    font-size: 14px;
    line-height: 1.5;
    margin: var(--sp-5) 0;
}

/* Advertencia */
.advertencia-racion {
    font-size: 0.85em;
    color: var(--c-red-500);
    text-align: center;
    margin-top: var(--sp-2);
}

/* =========================================================
   MODALS — small (confirm)
   ========================================================= */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(19, 28, 30, 0.5);
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
}

.modal-content {
    background: var(--c-white);
    padding: var(--sp-6);
    border: none;
    width: 320px;
    max-width: 88vw;
    text-align: center;
    border-radius: var(--r-lg);
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: modal-in var(--dur-mid) var(--ease-out);
}

@keyframes modal-in {
    from { opacity: 0; transform: scale(0.95) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-content p {
    color: var(--color-text);
    margin-bottom: var(--sp-1);
    font-size: 15px;
    font-weight: 500;
}

.modal-buttons {
    margin-top: var(--sp-5);
    display: flex;
    gap: var(--sp-3);
    justify-content: center;
}

.modal-buttons button {
    width: 90px;
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--r-pill);
}

.modal-buttons button:first-child {
    background: var(--c-red-500);
}

.modal-buttons button:first-child:hover {
    background: #c43c3c;
}

.modal-buttons button:last-child {
    background: var(--c-neutral-100);
    color: var(--color-text-muted);
}

.modal-buttons button:last-child:hover {
    background: var(--c-neutral-300);
    color: var(--color-text);
}

.close-modal {
    position: absolute;
    top: var(--sp-3);
    right: var(--sp-3);
    background: var(--c-neutral-100);
    border: none;
    color: var(--color-text-muted);
    font-size: 16px;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color var(--dur-fast), color var(--dur-fast);
}

.close-modal:hover {
    background: var(--c-neutral-900);
    color: var(--c-white);
}

/* =========================================================
   MODALS — large (info)
   ========================================================= */

.modal-info {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(19, 28, 30, 0.55);
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
}

.modal-info-content {
    background: var(--c-white);
    width: 88%;
    max-width: 600px;
    max-height: 85vh;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modal-in var(--dur-mid) var(--ease-out);
}

.modal-info-content .modal-header {
    padding: var(--sp-4) var(--sp-6);
    border-bottom: 1.5px solid var(--c-neutral-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--c-white);
    border-top-left-radius: var(--r-lg);
    border-top-right-radius: var(--r-lg);
    position: sticky;
    top: 0;
    z-index: 1;
    flex-shrink: 0;
}

.modal-info-content .modal-header h2 {
    margin: 0;
    color: var(--color-text);
    font-size: 1.1rem;
    font-weight: 600;
}

.close-info {
    width: 30px;
    height: 30px;
    background: var(--c-neutral-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 400;
    cursor: pointer;
    transition: background-color var(--dur-fast), color var(--dur-fast);
    color: var(--color-text-muted);
    flex-shrink: 0;
    line-height: 1;
}

.close-info:hover {
    background: var(--c-neutral-900);
    color: var(--c-white);
}

.modal-body {
    padding: var(--sp-6);
    overflow-y: auto;
    flex-grow: 1;
}

.modal-body h3 {
    color: var(--color-primary);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    margin: var(--sp-6) 0 var(--sp-2);
}

.modal-body h3:first-child { margin-top: 0; }

.modal-body p, .modal-body ul, .modal-body ol {
    color: var(--c-neutral-500);
    line-height: 1.65;
    margin-bottom: var(--sp-3);
    font-size: 14px;
}

.modal-body ul, .modal-body ol {
    padding-left: var(--sp-5);
}

.modal-body strong {
    color: var(--color-text);
    font-weight: 600;
}

.modal-body a {
    color: var(--color-primary);
    text-decoration: none;
}

.modal-body a:hover { text-decoration: underline; }

/* Ratio modal */
.ratio-inputs {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
    margin: var(--sp-5) 0;
}

.ratio-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.ratio-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.ratio-separator {
    font-size: 26px;
    font-weight: 300;
    color: var(--color-text-muted);
    margin-top: 34px;
    line-height: 1;
}

.ratio-inputs input {
    width: 80px;
    height: 72px;
    text-align: center;
    font-size: 26px;
    font-family: 'DM Mono', monospace;
    font-weight: 500;
    border-radius: var(--r-md);
    margin: 0;
    padding: 0;
}

.botones-ajuste-ratio {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 0;
    margin-top: 10px;
    width: 100%;
}

.botones-ajuste-ratio button {
    width: 36px;
    height: 36px;
    background: var(--c-amber-100);
    color: var(--c-neutral-700);
    border: 1.5px solid var(--c-amber-400);
    border-radius: 50%;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    cursor: pointer;
    transition: background-color var(--dur-fast), transform var(--dur-fast);
}

.botones-ajuste-ratio button:hover {
    background: var(--c-amber-200);
    transform: scale(1.08);
}

#ratioResultado {
    font-weight: 500;
    margin-top: var(--sp-5);
    color: var(--color-primary);
    font-size: 14px;
}

#btnAceptarRatio {
    margin-top: var(--sp-3);
    padding: 9px var(--sp-6);
    background: var(--color-primary);
    color: var(--c-white);
    border-radius: var(--r-pill);
    font-weight: 600;
    font-family: 'DM Sans', inherit;
    cursor: pointer;
    border: none;
}

#btnAceptarRatio:hover { background: var(--c-teal-500); }

#btnAceptarRatio:disabled {
    background: var(--c-neutral-100);
    color: var(--c-neutral-300);
    cursor: not-allowed;
}

/* =========================================================
   FOOD TABLE MODAL
   ========================================================= */

#listaRecetario .modal-info-content {
    width: 88%;
    max-width: 600px;
    height: 85vh;
    max-height: 85vh;
}

#listaRecetario .modal-header {
    padding: var(--sp-4) var(--sp-6);
    border-bottom: 1.5px solid var(--c-neutral-100);
    background: var(--c-white);
}

#listaRecetario .modal-header h2 {
    font-size: 1.05rem;
    color: var(--color-text);
}

#listaRecetario .modal-body {
    display: flex;
    flex-direction: column;
    padding: var(--sp-4) var(--sp-5);
    overflow: hidden;
}

#searchAlimento {
    width: 100% !important;
    padding: 10px 14px !important;
    margin-bottom: var(--sp-4) !important;
    box-sizing: border-box !important;
    border-radius: var(--r-md) !important;
    border: 1.5px solid var(--c-neutral-100) !important;
    font-size: 14px;
}

#listaRecetarioContainer {
    overflow-y: auto;
    flex-grow: 1;
    border-radius: var(--r-md);
    border: 1.5px solid var(--c-neutral-100);
}

#listaRecetario table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

#listaRecetario th, #listaRecetario td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--c-neutral-50);
    text-align: center;
    font-size: 13.5px;
    width: 33.33%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
}

#listaRecetario th {
    background: var(--c-teal-900);
    color: var(--c-white);
    position: sticky;
    top: 0;
    z-index: 10;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

#listaRecetario th:nth-child(1),
#listaRecetario td:nth-child(1) { width: 50%; text-align: left; }

#listaRecetario td:nth-child(1) { font-weight: 500; }

#listaRecetario tr:hover td {
    background-color: var(--c-teal-50);
}

.table-footer {
    margin-top: var(--sp-3);
    font-size: 12px;
    color: var(--color-text-muted);
    text-align: left;
    font-style: italic;
    padding: var(--sp-2) 0;
    flex-shrink: 0;
}

.table-footer p { margin: 2px 0; }

.btn-group {
    display: flex;
    justify-content: flex-end;
    background: var(--c-white);
    padding: var(--sp-4) var(--sp-5);
    z-index: 101;
    position: sticky;
    bottom: 0;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
    border-top: 1.5px solid var(--c-neutral-100);
}

#botonAgregar {
    background: var(--c-neutral-100);
    color: var(--c-neutral-300);
    cursor: not-allowed;
    font-weight: 600;
}

#botonAgregar.activo {
    background: var(--color-primary);
    color: var(--c-white);
    cursor: pointer;
}

#botonAgregar.activo:hover {
    background: var(--c-teal-500);
}

.sort-icon {
    font-size: 0.8em;
    margin-left: 4px;
}

/* =========================================================
   FOOTER
   ========================================================= */

#mainFooter {
    background: var(--c-teal-900);
    color: var(--c-white);
    padding: var(--sp-8) 0 var(--sp-6);
    margin-top: 0;
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

.footer-content {
    max-width: 700px;
    margin: 0 auto;
    padding: 0 var(--sp-5);
}

/* SEO block */
.seo-footer-content {
    text-align: center;
    padding-bottom: var(--sp-6);
    margin-bottom: var(--sp-6);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.seo-title {
    font-size: 15px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    margin: 0 0 var(--sp-2);
    line-height: 1.4;
}

.seo-description {
    font-size: 13px;
    color: rgba(255,255,255,0.55);
    line-height: 1.5;
    margin: 0 0 var(--sp-3);
}

.seo-keywords {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

.seo-keywords span {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.07);
    padding: 3px 10px;
    border-radius: var(--r-pill);
    border: 1px solid rgba(255,255,255,0.12);
    transition: all var(--dur-fast);
}

.seo-keywords span:hover {
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.8);
}

/* Footer links */
.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: var(--sp-5);
    gap: var(--sp-1) var(--sp-5);
    align-items: center;
}

.footer-links a {
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: color var(--dur-fast);
}

.footer-links a:hover { color: var(--c-white); }

.footer-info {
    text-align: center;
    font-size: 12px;
    color: rgba(255,255,255,0.4);
    margin-top: var(--sp-5);
}

/* PWA install row */
.pwa-install-row {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    margin: var(--sp-4) 0;
    text-align: center !important;
    width: 100% !important;
}

.pwa-install-entry {
    background: transparent;
    border: 1.5px solid rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.75);
    border-radius: var(--r-pill);
    padding: 8px 20px;
    font-size: 13px;
    font-family: 'DM Sans', inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--dur-fast);
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
}

.pwa-install-entry.is-active {
    background: var(--c-amber-400);
    border-color: var(--c-amber-400);
    color: var(--c-neutral-900);
    font-weight: 600;
}

.pwa-install-entry.is-active:hover {
    background: var(--c-amber-500);
}

.pwa-install-entry.is-disabled,
.pwa-install-entry[disabled],
.pwa-install-entry[aria-disabled="true"] {
    opacity: 0.25;
    cursor: not-allowed;
    pointer-events: none;
}

/* =========================================================
   COOKIE BANNER
   ========================================================= */

.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--c-neutral-900);
    color: var(--c-white);
    padding: var(--sp-4) var(--sp-5);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 2000;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.2);
    transform: translateY(100%);
    transition: transform var(--dur-slow) var(--ease-out);
    gap: var(--sp-5);
}

.cookie-banner.show { transform: translateY(0); }

.cookie-banner-content {
    display: flex;
    align-items: center;
    flex-grow: 1;
    gap: var(--sp-5);
    flex-wrap: wrap;
}

.cookie-banner-text {
    font-size: 13.5px;
    line-height: 1.5;
    color: rgba(255,255,255,0.8);
    flex: 1;
    min-width: 200px;
}

.cookie-banner-buttons {
    display: flex;
    gap: var(--sp-2);
    flex-shrink: 0;
}

.cookie-banner-button {
    padding: 8px 18px;
    border-radius: var(--r-pill);
    cursor: pointer;
    font-size: 13.5px;
    font-family: 'DM Sans', inherit;
    font-weight: 500;
    white-space: nowrap;
    transition: all var(--dur-fast);
    border: none;
}

.cookie-banner-button.cookie-accept {
    background: var(--color-primary);
    color: var(--c-white);
}

.cookie-banner-button.cookie-accept:hover {
    background: var(--c-teal-500);
}

.cookie-banner-button.cookie-reject {
    background: transparent;
    border: 1.5px solid rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.7);
}

.cookie-banner-button.cookie-reject:hover {
    background: rgba(255,255,255,0.08);
    color: var(--c-white);
    border-color: rgba(255,255,255,0.5);
}

.cookie-link {
    color: var(--c-teal-300);
    text-decoration: underline;
    margin-left: var(--sp-1);
    transition: color var(--dur-fast);
}

.cookie-link:hover { color: var(--c-white); }

/* =========================================================
   DONATION MODAL
   ========================================================= */

.donation-content { text-align: center; }

.donation-content p {
    margin-bottom: var(--sp-4);
    line-height: 1.65;
    color: var(--color-text-muted);
}

.donation-content ul {
    text-align: left;
    margin: var(--sp-4) 0;
    padding-left: var(--sp-5);
}

.donation-content li {
    margin-bottom: var(--sp-2);
    color: var(--color-text-muted);
    font-size: 14px;
}

.donation-button-container {
    margin: var(--sp-6) 0;
    display: flex;
    justify-content: center;
}

.paypal-donate-button {
    display: inline-block;
    transition: transform var(--dur-fast);
}

.paypal-donate-button:hover { transform: scale(1.04); }

.paypal-button-image {
    border: none;
    border-radius: var(--r-md);
    box-shadow: var(--shadow-sm);
}

.donation-note {
    color: var(--c-neutral-300);
    font-size: 12px;
    font-style: italic;
    margin-top: var(--sp-5);
}

/* =========================================================
   LANGUAGE SELECTOR
   ========================================================= */

.language-selector {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001;
}

#languageSelect {
    background: rgba(255,255,255,0.1);
    border: 1.5px solid rgba(255,255,255,0.2);
    color: var(--c-white);
    padding: 6px 10px;
    border-radius: var(--r-sm);
    font-size: 13px;
    font-family: 'DM Sans', inherit;
    cursor: pointer;
    outline: none;
   
    font-weight: 500;
    min-width: 70px;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='white' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 24px;
}

#languageSelect:hover {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.4);
}

#languageSelect option {
    background: var(--c-teal-900);
    color: var(--c-white);
    padding: 5px;
    font-weight: 500;
}

#header { padding-right: 100px; }

/* =========================================================
   MISC SETTINGS ELEMENTS
   ========================================================= */

.settings-container {
    position: relative;
    border: 1.5px solid var(--c-amber-400);
    border-radius: var(--r-md);
    padding: var(--sp-3) var(--sp-3) var(--sp-3);
    flex-grow: 0;
    background: var(--c-amber-100);
}

.settings-label {
    position: absolute;
    top: -10px;
    left: 50%;
    border-radius: var(--r-sm);
    transform: translateX(-50%);
    background: var(--color-background);
    padding: 0 10px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--c-amber-500);
    text-transform: uppercase;
}

.settings-buttons {
    display: flex;
    justify-content: center;
    gap: var(--sp-5);
}

.ajuste-btn {
    width: 100%;
    padding: 9px var(--sp-3);
    margin: 4px 0;
    background: var(--c-amber-100);
    color: var(--color-text);
    border: none;
    border-radius: var(--r-sm);
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    font-family: 'DM Sans', inherit;
    transition: background-color var(--dur-fast);
}

.ajuste-btn:hover { background: var(--c-amber-200); }

/* Close-btn generic */
.close-btn-cambiar {
    position: absolute;
    top: var(--sp-3);
    right: var(--sp-3);
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 18px;
    cursor: pointer;
}

.tabla-alimentos-link {
    margin-left: 0;
    margin-bottom: var(--sp-5);
    text-decoration: none;
    color: var(--color-primary);
    font-size: 14px;
    font-weight: 500;
}

.tabla-alimentos-link:hover { text-decoration: underline; }

/* Campo personalizado */
.campo-personalizado {
    margin: var(--sp-4) 0;
    padding: var(--sp-4);
    background: var(--c-neutral-50);
    border-radius: var(--r-md);
    border: 1.5px solid var(--c-neutral-100);
}

.campo-personalizado label {
    margin-bottom: var(--sp-2);
    font-weight: 500;
    color: var(--color-text);
    font-size: 14px;
}

.campo-personalizado input {
    width: 80px;
    padding: 8px 12px;
    border: 1.5px solid var(--c-neutral-100);
    border-radius: var(--r-sm);
    font-size: 16px;
    text-align: center;
    font-family: 'DM Mono', monospace;
}

.campo-personalizado input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(32, 145, 154, 0.15);
}

.campo-personalizado span {
    margin-left: var(--sp-2);
    color: var(--color-text-muted);
    font-weight: 500;
    font-size: 14px;
}

/* =========================================================
   AJUSTES MODAL
   ========================================================= */

#modalAjustes .modal-content {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

#ajustesList { flex-grow: 1; }

/* Donate link in footer */
.donate-link {
    display: inline-flex !important;
    align-items: center;
    gap: var(--sp-2);
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.8) !important;
    padding: 7px 14px;
    border-radius: var(--r-pill);
    text-decoration: none !important;
    font-weight: 500;
    font-size: 13.5px;
    transition: all var(--dur-fast);
    border: 1.5px solid rgba(255,255,255,0.2);
}

.donate-link:hover {
    background: rgba(255,255,255,0.18);
    color: var(--c-white) !important;
    border-color: rgba(255,255,255,0.4);
}

.pizza-emoji { font-size: 16px; }

/* Info modal close (generic) */
#modalComoUsar .close-info,
#modalContacto .close-info,
#modalTerminos .close-info {
    line-height: 1;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 600px) {
    body {
        padding: 70px 14px 0;
    }

    .block {
        width: calc(50% - var(--sp-2));
    }

    .container {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }

    .footer-links {
        flex-direction: column;
        align-items: center;
        gap: var(--sp-3);
    }

    .cookie-banner {
        flex-direction: column;
        gap: var(--sp-4);
        text-align: center;
        padding: var(--sp-5);
    }

    .cookie-banner-content {
        flex-direction: column;
        gap: var(--sp-3);
    }

    .cookie-banner-buttons {
        width: 100%;
        flex-direction: column;
    }

    .cookie-banner-button {
        width: 100%;
    }

    .language-selector { right: 14px; }
    #languageSelect { padding: 5px 8px; font-size: 12px; min-width: 60px; }
    #header { padding-right: 80px; }

    .sponsor-banner-content {
        flex-direction: column;
        gap: var(--sp-3);
    }

    .modal-info-content { width: 95%; max-height: 92vh; }

    .settings-row { gap: var(--sp-1); }
    .boton-3d { padding: 8px 11px; font-size: 12px; }

    .seo-title { font-size: 14px; }
    .seo-description { font-size: 12px; }
    .seo-keywords span { font-size: 10px; }

    .pwa-install-row { margin: var(--sp-3) 0; }

    .totales-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    .total-chip {
        padding: 10px 4px 8px;
    }

    .total-chip .valor {
        font-size: 1rem;
    }

    .total-chip .etiqueta {
        font-size: 0.6rem;
        letter-spacing: 0.04em;
    }

    .saved-foods-table th {
        font-size: 11px !important;
        padding: 8px 6px !important;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    /* 2. Filas con más "aire" para que sea más fácil tocar con el dedo */
    .saved-foods-table td {
        padding: 14px 2px !important;
        font-size: 14px !important;
        border-bottom: 1px solid var(--c-neutral-100) !important;
    }

    /* 3. Evita que textos largos rompan la tabla (añade "...") */
    .saved-name-cell {
        max-width: 130px; 
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-weight: 500;
        color: var(--c-teal-900);
    }

    /* 4. Inputs de edición más cómodos en móvil */
    .saved-edit-input {
        font-size: 14px !important;
        padding: 8px 4px !important; 
    }

    /* 5. Ajuste visual de los botones de acción para mejor área táctil */
    .saved-actions-cell .btn-fav-icon {
        padding: 6px !important; 
        background: var(--c-neutral-50); 
        border-radius: var(--r-sm);
    }
    
    .saved-actions-cell .btn-fav-icon span {
        font-size: 18px !important; 
    }
    
    
}

@media (max-width: 400px) {
    .language-selector { right: 10px; }
    #languageSelect { font-size: 11px; min-width: 50px; }
    #header { padding-right: 70px; }
}

@media screen and (max-height: 450px) and (orientation: portrait) {
    #sideMenu { padding-top: 10px; }
    #sideMenu a { font-size: 16px; }
    #listaRecetario .modal-info-content {
        width: 95%;
        height: 95%;
        margin: auto;
    }
}

/* =========================================================
   CONTENIDO MENU (inline content panel)
   ========================================================= */

#contenidoMenu {
    transition: margin-left 0.25s;
    /*padding: var(--sp-5);*/
}

#contenidoMenu h2 { margin-bottom: var(--sp-4); }

#contenidoMenu p,
#contenidoMenu ul,
#contenidoMenu ol {
    margin-bottom: var(--sp-3);
    color: var(--color-text-muted);
    font-size: 14px;
    line-height: 1.65;
}

#contenidoMenu li { margin-left: var(--sp-5); }

/* =========================================================
   OVERFLOW & UTILITY
   ========================================================= */

.fi {
    width: 16px;
    height: 12px;
    margin-right: 5px;
    display: inline-block;
    vertical-align: middle;
}

/* Shared sponsor logo placeholders */
.sponsor-banner-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-8);
    margin-top: var(--sp-3);
    flex-wrap: wrap;
}

.sponsor-logo-placeholder {
    width: 120px;
    height: 40px;
    background: rgba(255,255,255,0.15);
    border: 2px dashed rgba(255,255,255,0.3);
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    transition: all var(--dur-fast);
}

.sponsor-logo-placeholder:hover {
    background: rgba(255,255,255,0.22);
}

/* Sponsor */
.sponsor-full {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--c-white);
    border-top: 1.5px solid var(--c-neutral-100);
    padding: 14px 28px;
    width: 100vw;
    position: relative;
    left: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    /*margin-top: var(--sp-8);*/
    box-sizing: border-box;
}

.sponsor-label {
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 500;
    color: var(--c-neutral-300);
    text-align: center;
    margin-bottom: 5px;
}

.sponsor-logos-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

.sponsor-logo-link {
    display: flex;
    align-items: center;
    gap: 3px;
    text-decoration: none;
    color: var(--c-teal-500);
    transition: opacity var(--dur-fast);
}

.sponsor-logo-link:hover {
    opacity: 0.75;
}

.sponsor-name {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.02em;
    font-family: 'DM Sans', inherit;
}


/* =========================================================
   FAVORITOS
   ========================================================= */

/* Botón guardar favorito (junto al botón Añadir) */
.btn-favorito-guardar {
    color: var(--c-amber-400);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color var(--dur-fast), transform var(--dur-fast);
    flex-shrink: 0;
}

.btn-favorito-guardar:hover {
    color: var(--c-amber-500);
    transform: translateY(-1px);
}

.btn-favorito-guardar .material-symbols-outlined {
    font-size: 42px;
    font-variation-settings: 'FILL' 0, 'wght' 250;
}

/* Separador en menú lateral */
.menu-separator {
    height: 1.5px;
    background: var(--c-neutral-100);
    margin: 8px 0;
}

/* Link de favoritos en menú — estilo especial */
#sideMenu a.menu-favoritos-link {
    color: var(--c-amber-500);
    font-weight: 600;
    border-left-color: transparent;
    display: flex;
    align-items: center;
}

#sideMenu a.menu-favoritos-link:hover {
    color: var(--c-amber-500);
    background-color: var(--c-amber-100);
    border-left-color: var(--c-amber-400);
}

/* Lista de favoritos en modal */
.fav-item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: 12px var(--sp-4);
    border-radius: var(--r-md);
    border: 1.5px solid var(--c-neutral-100);
    background: var(--c-neutral-50);
    margin-bottom: var(--sp-3);
    transition: border-color var(--dur-fast);
}

.fav-item:hover {
    border-color: var(--c-teal-300);
}

.fav-item-info {
    flex: 1;
    min-width: 0;
}

.fav-item-nombre {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}

.fav-item-nombre input {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--color-text);
    border: 1.5px solid var(--c-teal-300);
    border-radius: var(--r-sm);
    padding: 4px 8px;
    width: 100%;
    background: var(--c-white);
    font-family: 'DM Sans', inherit;
}

.fav-item-detalles {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.fav-item-acciones {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.btn-fav-icon {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--dur-fast);
    color: var(--color-text-muted);
    width: 30px;
    height: 30px;
}

.btn-fav-icon:hover {
    background: var(--c-neutral-100);
    color: var(--color-text);
}

.btn-fav-icon.eliminar:hover {
    background: var(--c-red-100);
    color: var(--c-red-500);
}

.btn-fav-icon .material-symbols-outlined {
    font-size: 18px;
}

/* Footer del modal favoritos */
.favoritos-footer {
    border-top: 1.5px solid var(--c-neutral-100);
    padding: var(--sp-4) var(--sp-5);
    background: var(--c-neutral-50);
    border-radius: 0 0 var(--r-lg) var(--r-lg);
}

.favoritos-footer-actions {
    display: flex;
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
}

.btn-fav-accion {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--c-white);
    border: 1.5px solid var(--c-neutral-100);
    color: var(--color-text);
    border-radius: var(--r-pill);
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    font-family: 'DM Sans', inherit;
    cursor: pointer;
    transition: background-color var(--dur-fast), border-color var(--dur-fast);
}

.btn-fav-accion:hover {
    background: var(--c-teal-50);
    border-color: var(--c-teal-300);
    color: var(--color-primary);
}

.favoritos-aviso {
    font-size: 12px;
    color: var(--color-text-muted);
    line-height: 1.6;
    margin: 0;
}

.favoritos-aviso .material-symbols-outlined {
    font-size: 14px;
    vertical-align: middle;
    margin-right: 4px;
}

/* Empty state */
.fav-empty {
    text-align: center;
    color: var(--color-text-muted);
    padding: var(--sp-8) var(--sp-4);
    font-size: 14px;
}

.fav-empty .material-symbols-outlined {
    font-size: 40px;
    display: block;
    margin-bottom: var(--sp-3);
    color: var(--c-neutral-300);
}

/* =========================================================
   BOOKMARK SAVE ICON ON FOOD CARD
   ========================================================= */

.bookmark-save-btn {
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    color: var(--c-teal-500);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    transition: background-color var(--dur-fast), color var(--dur-fast), transform var(--dur-fast);
    animation: bookmark-appear 0.3s var(--ease-out);
}

@keyframes bookmark-appear {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

.bookmark-save-btn:hover {
    background: var(--c-teal-100);
    color: var(--c-teal-700);
    transform: scale(1.15);
}

.bookmark-save-btn .material-symbols-outlined {
    font-size: 18px;
    font-variation-settings: 'FILL' 0, 'wght' 400;
}

.bookmark-save-btn:hover .material-symbols-outlined {
    font-variation-settings: 'FILL' 1, 'wght' 400;
}

.bookmark-save-btn.saved-flash {
    animation: bookmark-flash 0.6s var(--ease-out);
}

.bookmark-save-btn.saved-flash .material-symbols-outlined {
    font-variation-settings: 'FILL' 1, 'wght' 400;
    color: var(--c-green-500);
}

@keyframes bookmark-flash {
    0% { transform: scale(1); }
    30% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* =========================================================
   FOOD TABLE TABS
   ========================================================= */

.food-table-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1.5px solid var(--c-neutral-100);
    padding: 0 var(--sp-5);
    flex-shrink: 0;
}

.food-tab {
    flex: 1;
    padding: 10px var(--sp-4);
    background: none;
    border: none;
    border-bottom: 2.5px solid transparent;
    color: var(--color-text-muted);
    font-size: 13.5px;
    font-weight: 500;
    font-family: 'DM Sans', inherit;
    cursor: pointer;
    transition: color var(--dur-fast), border-color var(--dur-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-radius: 0;
}

.food-tab:hover {
    color: var(--color-text);
    background: none;
}

.food-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: 600;
    background: none;
}

/* =========================================================
   SAVED FOODS TABLE
   ========================================================= */

.saved-empty {
    text-align: center;
    color: var(--color-text-muted);
    padding: var(--sp-8) var(--sp-4);
    font-size: 14px;
}

.saved-empty .material-symbols-outlined {
    font-size: 40px;
    display: block;
    margin: 0 auto var(--sp-3);
    color: var(--c-neutral-300);
}

.saved-foods-table {
    width: 100%;
    border-collapse: collapse;
}

.saved-foods-table thead th {
    background: var(--c-teal-900);
    color: var(--c-white);
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.saved-foods-table thead th:first-child {
    text-align: left;
}

.saved-foods-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--c-neutral-50);
    font-size: 13.5px;
    text-align: center;
    vertical-align: middle;
}

.saved-foods-table tbody td:first-child {
    text-align: left;
    font-weight: 500;
}

.saved-foods-table tbody tr:hover td {
    background-color: var(--c-teal-50);
}

.saved-actions-cell {
    /* Quitamos el display: flex que rompía la tabla */
    text-align: center;
    white-space: nowrap; /* Evita que un botón caiga debajo del otro */
}

/* Forzamos a que los botones se comporten como elementos en línea 
   y usamos margin en lugar de "gap" */
.saved-actions-cell .btn-fav-icon {
    display: inline-flex !important;
    vertical-align: middle;
    margin: 0 2px; 
}

.saved-name-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.saved-edit-input {
    width: 100% !important;
    min-width: 0 !important; /* CRÍTICO: Evita que el input expanda la celda en móviles */
    box-sizing: border-box !important; /* CRÍTICO: El padding no suma al ancho total */
    padding: 5px 8px !important;
    font-size: 13px !important;
    border: 1.5px solid var(--c-teal-300) !important;
    border-radius: var(--r-sm) !important;
    font-family: 'DM Sans', inherit !important;
}

.saved-edit-hc {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 65px !important; /* Limitamos el tamaño máximo para que no se vea desproporcionado */
    text-align: center !important;
    font-family: 'DM Mono', monospace !important;
}

/* =========================================================
   MENU IMPORT/EXPORT BUTTONS
   ========================================================= */

.menu-bottom-spacer {
    flex-grow: 1;
    min-height: var(--sp-6);
}

.menu-import-export {
    padding: var(--sp-4) var(--sp-5);
    border-top: 1.5px solid var(--c-neutral-100);
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.btn-menu-io {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--c-neutral-50);
    border: 1.5px solid var(--c-neutral-100);
    color: var(--color-text-muted);
    border-radius: var(--r-pill);
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 500;
    font-family: 'DM Sans', inherit;
    cursor: pointer;
    transition: background-color var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
    white-space: nowrap;
}

.btn-menu-io:hover {
    background: var(--c-teal-50);
    border-color: var(--c-teal-300);
    color: var(--color-primary);
}

/* Make sideMenu flex to push import/export to bottom */
#sideMenu {
    display: flex;
    flex-direction: column;
}


/* =========================================================
   BOOKMARK SAVED STATE — filled bookmark on saved foods
   ========================================================= */

.bookmark-save-btn.bookmark-saved {
    cursor: default;
    color: var(--c-teal-600, var(--c-teal-700));
}

.bookmark-save-btn.bookmark-saved .material-symbols-outlined {
    font-variation-settings: 'FILL' 1, 'wght' 500;
    color: var(--c-teal-500);
}

.bookmark-save-btn.bookmark-saved:hover {
    background: var(--c-teal-50);
    transform: none;
}

/* =========================================================
   MODAL CONFIRMACIÓN GENÉRICA
   ========================================================= */

.modal-confirm-content {
    max-width: 320px;
    width: 90%;
    text-align: center;
    padding: var(--sp-6) var(--sp-5);
}

.modal-confirm-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--c-red-100);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--sp-4);
}

.modal-confirm-icon .material-symbols-outlined {
    font-size: 26px;
    color: var(--c-red-500);
}

.modal-confirm-msg {
    font-size: 15px;
    font-weight: 500;
    color: var(--color-text);
    margin: 0 0 var(--sp-5);
    line-height: 1.5;
}

.modal-confirm-btn-yes {
    background: var(--c-red-500);
    color: var(--c-white);
    border: none;
    border-radius: var(--r-pill);
    padding: 9px 22px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'DM Sans', inherit;
    cursor: pointer;
    transition: background var(--dur-fast);
    margin-right: var(--sp-2);
}

.modal-confirm-btn-yes:hover {
    background: #b83d3d;
}

.modal-confirm-btn-no {
    background: var(--c-neutral-100);
    color: var(--color-text-muted);
    border: none;
    border-radius: var(--r-pill);
    padding: 9px 22px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'DM Sans', inherit;
    cursor: pointer;
    transition: background var(--dur-fast);
    margin-left: var(--sp-2);
}

.modal-confirm-btn-no:hover {
    background: var(--c-neutral-300);
    color: var(--color-text);
}

/* =========================================================
   BIENVENIDA MODAL — improved welcome screen
   ========================================================= */

.modal-bienvenida-content {
    max-width: 420px !important;
}

.bienvenida-header {
    background: linear-gradient(135deg, var(--c-teal-900) 0%, var(--c-teal-700) 100%);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    padding: var(--sp-5) var(--sp-5) var(--sp-4) !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 !important;
}

.bienvenida-header .close-info {
    color: rgba(255,255,255,0.75) !important;
    font-size: 24px;
}

.bienvenida-header .close-info:hover {
    color: var(--c-white) !important;
}

.bienvenida-logo-wrap {
    display: flex;
    align-items: center;
}

.bienvenida-logo {
    height: 36px;
    width: auto;
    /*filter: brightness(0) invert(1); */
}

.bienvenida-body {
    padding: var(--sp-5) var(--sp-6) var(--sp-6) !important;
}

.bienvenida-titulo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--c-teal-900);
    margin: 0 0 var(--sp-1);
    letter-spacing: -0.02em;
}

.bienvenida-subtitulo {
    font-size: 14px;
    color: var(--color-text-muted);
    margin: 0 0 var(--sp-5);
}

.bienvenida-features {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    margin-bottom: var(--sp-5);
}

.bienvenida-feature {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    background: var(--c-teal-50);
    border: 1px solid var(--c-teal-100);
    border-radius: var(--r-md);
    padding: var(--sp-3) var(--sp-4);
}

.bienvenida-icon {
    font-size: 22px;
    color: var(--c-teal-500);
    flex-shrink: 0;
}

.bienvenida-feature div {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.bienvenida-feature strong {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--c-teal-900);
}

.bienvenida-feature span {
    font-size: 12.5px;
    color: var(--color-text-muted);
}

.bienvenida-aviso {
    margin-bottom: var(--sp-5) !important;
}

.bienvenida-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    width: 100%;
    background: linear-gradient(135deg, var(--c-teal-700), var(--c-teal-500));
    color: var(--c-white);
    border: none;
    border-radius: var(--r-pill);
    padding: 13px var(--sp-5);
    font-size: 15px;
    font-weight: 600;
    font-family: 'DM Sans', inherit;
    cursor: pointer;
    transition: opacity var(--dur-fast), transform var(--dur-fast);
    margin-bottom: var(--sp-3);
    letter-spacing: -0.01em;
}

.bienvenida-cta:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.bienvenida-info-link {
    text-align: center;
    font-size: 12.5px;
    color: var(--color-text-muted);
    margin: 0;
}

.bienvenida-info-link a {
    color: var(--c-teal-600, var(--c-teal-700));
    text-decoration: underline;
    text-decoration-color: var(--c-teal-300);
    text-underline-offset: 2px;
}

/* Responsive tweaks */
@media (max-width: 480px) {
    .bienvenida-body {
        padding: var(--sp-4) var(--sp-4) var(--sp-5) !important;
    }

    .modal-bienvenida-content {
        max-height: 95dvh !important;
    }
}

/* =========================================================
   SAVED FOODS TABLE — search field in guardados tab
   ========================================================= */

#searchGuardados {
    width: 100%;
    padding: 10px 14px;
    margin-bottom: 12px;
    box-sizing: border-box;
    border: 1.5px solid var(--c-neutral-100);
    border-radius: var(--r-md);
    font-size: 14px;
    font-family: 'DM Sans', inherit;
    color: var(--color-text);
    background: var(--c-white);
    outline: none;
    transition: border-color var(--dur-fast);
}

#searchGuardados:focus {
    border-color: var(--c-teal-500);
}
/* =========================================================
   SWIPE TO DELETE — Food Cards (Mobile)
   ========================================================= */

.alimento {
    overflow: hidden;
}

.alimento-swipe-bg {
    position: absolute;
    inset: 0;
    background: var(--c-red-500);
    border-radius: var(--r-lg);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 24px;
    opacity: 0;
    transition: opacity 0.15s var(--ease-in-out);
    pointer-events: none;
    z-index: 0;
}

.alimento-swipe-bg .swipe-delete-icon {
    font-size: 28px;
    color: var(--c-white);
    transition: transform 0.2s var(--ease-out);
}

.alimento-swipe-bg.swipe-left {
    justify-content: flex-end;
    padding-right: 24px;
    padding-left: 0;
}

.alimento-swipe-bg.swipe-right {
    justify-content: flex-start;
    padding-left: 24px;
    padding-right: 0;
}

.alimento-inner {
    position: relative;
    z-index: 1;
    background: var(--color-surface);
    border-radius: var(--r-lg);
    padding: var(--sp-5) var(--sp-5) var(--sp-4);
    transition: transform 0.08s linear, box-shadow 0.15s var(--ease-in-out);
    will-change: transform;
}

/* Cuando se supera el umbral, el icono se agranda */
.alimento.swipe-threshold-reached .swipe-delete-icon {
    transform: scale(1.25);
}

/* Snap back suave */
.alimento-inner.snap-back {
    transform: translateX(0) !important;
    transition: transform 0.35s var(--ease-out) !important;
}

/* =========================================================
   APP TOAST NOTIFICATION
   ========================================================= */
.app-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    background: var(--c-amber-100);
    border: 1.5px solid var(--c-amber-400);
    color: var(--c-amber-500);
    border-radius: var(--r-pill);
    padding: 10px var(--sp-5) 10px var(--sp-4);
    box-shadow: var(--shadow-md);
    font-size: 14px;
    font-weight: 500;
    font-family: 'DM Sans', inherit;
    white-space: nowrap;
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.22s ease, transform 0.22s ease;
    pointer-events: none;
}

@media (max-width: 480px) {
    .app-toast {
        white-space: normal;
        width: max-content;
        max-width: 72vw;
        font-size: 13px;
        padding: 9px var(--sp-4) 9px var(--sp-3);
        text-align: center;
        line-height: 1.4;
    }
}

.app-toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.app-toast-icon {
    font-size: 18px;
    flex-shrink: 0;
    color: var(--c-amber-500);
}