.allergen-legend-copy,
.allergies-section {
    background-color: #f5f5f5;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    text-align: center;
}

.allergen-legend-copy {
    margin-bottom: 0;
    padding-bottom: 8px;
    border-radius: 10px 10px 0 0;
}

.allergen-legend-copy + .allergen-legend-icons {
    margin-top: 0;
    border-radius: 0 0 10px 10px;
    padding-top: 8px;
}

.allergen-legend-icons {
    background-color: #f5f5f5;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 12px;
}

.allergen-legend-page-wrap {
    margin-bottom: 12px;
}

.allergen-legend-grid {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: flex-start;
    gap: 8px;
    max-width: 100%;
    margin: 0 auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 2px;
}

.allergen-legend-grid::-webkit-scrollbar {
    height: 4px;
}

.allergen-legend-grid::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.allergen-legend-item {
    flex: 0 0 44px;
    width: 44px;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
    display: flex;
    flex-direction: column;
}

.allergen-legend-icon-wrap {
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px;
}

.allergen-legend-icon {
    max-width: 100%;
    max-height: 24px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.allergen-legend-label {
    display: block;
    font-size: 7px;
    font-weight: 600;
    line-height: 1.15;
    color: #fff;
    background: #6abd62;
    padding: 3px 1px;
    font-family: Montserrat, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.allergies-heading {
    color: #d33a31;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
    letter-spacing: 0.02em;
}

.allergies-description {
    color: #333333;
    font-size: 11px;
    line-height: 1.35;
    margin: 6px 0 0;
}

@media screen and (max-width: 480px) {
    .allergies-heading {
        font-size: 12px;
    }

    .allergies-description {
        font-size: 10px;
        margin-top: 4px;
    }

    .allergen-legend-copy,
    .allergies-section {
        padding: 8px 10px;
    }

    .allergen-legend-icons {
        padding: 8px 10px;
    }

    .allergen-legend-grid {
        justify-content: flex-start;
        gap: 6px;
    }

    .allergen-legend-item {
        flex: 0 0 38px;
        width: 38px;
    }

    .allergen-legend-icon-wrap {
        height: 26px;
        padding: 2px;
    }

    .allergen-legend-icon {
        max-height: 20px;
    }

    .allergen-legend-label {
        font-size: 6px;
        padding: 2px 1px;
    }
}

@media screen and (min-width: 481px) and (max-width: 767px) {
    .allergen-legend-icons {
        padding: 8px 12px;
    }

    .allergen-legend-grid {
        gap: 7px;
    }

    .allergen-legend-item {
        flex: 0 0 42px;
        width: 42px;
    }

    .allergen-legend-icon-wrap {
        height: 28px;
    }

    .allergen-legend-icon {
        max-height: 22px;
    }
}

@media screen and (min-width: 768px) {
    .allergen-legend-grid {
        gap: 8px;
        overflow-x: visible;
    }

    .allergen-legend-item {
        flex: 0 0 46px;
        width: 46px;
    }

    .allergen-legend-icon-wrap {
        height: 32px;
    }

    .allergen-legend-icon {
        max-height: 26px;
    }

    .allergies-heading {
        font-size: 15px;
    }

    .allergies-description {
        font-size: 12px;
    }
}

.meal-allergen-row {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 7px;
    margin: 6px 0 8px;
    width: fit-content;
    max-width: 100%;
}

.meal-allergen-row--highlight {
    background: #f8fbf8;
    border: 1px solid #e3ede1;
    border-radius: 999px;
    padding: 4px 10px 4px 11px;
    margin: 5px 0 8px;
    box-shadow: none;
}

.meal-allergen-label {
    font-size: 10px;
    font-weight: 600;
    color: #5a8f55;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
    line-height: 1;
}

.meal-allergen-icons {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
}

.meal-allergen-chip {
    position: relative;
    display: inline-flex;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #e8efe7;
    border-radius: 7px;
    box-shadow: none;
    flex-shrink: 0;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.meal-allergen-chip:hover,
.meal-allergen-chip:focus,
.meal-allergen-chip.is-active {
    border-color: #6abd62;
    background: #fff;
    box-shadow: none;
    transform: none;
}

.meal-allergen-chip img {
    width: 19px;
    height: 19px;
    object-fit: contain;
    display: block;
    pointer-events: none;
}

.meal-allergen-chip-tooltip {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 6px);
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    padding: 4px 8px;
    border-radius: 5px;
    white-space: nowrap;
    max-width: 140px;
    text-overflow: ellipsis;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    z-index: 30;
    font-family: Montserrat, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.meal-allergen-chip-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1e293b;
}

.meal-allergen-chip:hover .meal-allergen-chip-tooltip,
.meal-allergen-chip:focus .meal-allergen-chip-tooltip,
.meal-allergen-chip.is-active .meal-allergen-chip-tooltip {
    opacity: 1;
    visibility: visible;
}

.meal-card .meal-allergen-row {
    margin: 4px 0 8px;
}

.meal-card .meal-allergen-row--highlight {
    margin: 4px 0 8px;
}

@media screen and (max-width: 480px) {
    .meal-allergen-label {
        font-size: 9px;
    }

    .meal-allergen-row--highlight {
        padding: 4px 9px 4px 10px;
    }

    .meal-allergen-chip {
        width: 26px;
        height: 26px;
    }

    .meal-allergen-chip img {
        width: 17px;
        height: 17px;
    }
}

.meal-modal-allergens {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px 10px 10px;
    margin: 8px 0 10px;
}

.meal-modal-allergens-title {
    margin: 0 0 2px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #64748b;
}

.meal-modal-allergens-sub {
    margin: 0 0 6px;
    font-size: 11px;
    line-height: 1.3;
    color: #475569;
}

.meal-modal-allergens-grid {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 6px;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.meal-modal-allergen-tile {
    flex: 0 0 40px;
    width: 40px;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.07);
    border: 1px solid #eef2f7;
    display: flex;
    flex-direction: column;
}

.meal-modal-allergen-icon-wrap {
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px;
}

.meal-modal-allergen-icon-wrap img {
    max-width: 100%;
    max-height: 22px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.meal-modal-allergen-label {
    display: block;
    font-size: 6px;
    font-weight: 600;
    line-height: 1.15;
    color: #fff;
    background: #6abd62;
    padding: 3px 1px;
    text-align: center;
    font-family: Montserrat, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media screen and (max-width: 480px) {
    .meal-modal-allergens {
        padding: 7px 9px 9px;
        margin: 6px 0 8px;
    }

    .meal-modal-allergens-sub {
        font-size: 10px;
        margin-bottom: 5px;
    }

    .meal-modal-allergen-tile {
        flex: 0 0 36px;
        width: 36px;
    }

    .meal-modal-allergen-icon-wrap {
        height: 24px;
        padding: 2px;
    }

    .meal-modal-allergen-icon-wrap img {
        max-height: 18px;
    }

    .meal-modal-allergen-label {
        font-size: 5px;
        padding: 2px 1px;
    }
}

@media screen and (min-width: 768px) {
    .meal-modal-allergen-tile {
        flex: 0 0 42px;
        width: 42px;
    }

    .meal-modal-allergen-icon-wrap {
        height: 30px;
    }

    .meal-modal-allergen-icon-wrap img {
        max-height: 24px;
    }

    .meal-modal-allergen-label {
        font-size: 7px;
    }
}
