:root {
    --fi-primary: #0d6efd;
    --fi-primary-dark: #0b5ed7;
    --fi-bg-soft: #f5f8ff;
    --fi-card-border: #e8edf5;
    --fi-text-soft: #667085;
    --fi-success-soft: #ebfff2;
    --fi-warning-soft: #fff8e8;
    --fi-danger-soft: #fff1f1;
}

html, body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #1f2937;
    background: #ffffff;
}

a {
    color: var(--fi-primary-dark);
    text-decoration: none;
}

a:hover {
    color: #084298;
}

.main-content {
    min-height: 65vh;
}

.hero-section {
    background: linear-gradient(135deg, #f8fbff 0%, #eef5ff 100%);
    border-bottom: 1px solid #e7effa;
}

.hero-search-box,
.fi-card,
.metric-card,
.footer-stat-card,
.compare-food-card,
.calculator-card,
.nutrient-card,
.summary-card {
    background: #fff;
    border: 1px solid var(--fi-card-border);
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(16, 24, 40, 0.05);
}

.fi-card,
.metric-card,
.compare-food-card,
.calculator-card,
.nutrient-card,
.summary-card {
    padding: 1.25rem;
}

.hero-search-box {
    padding: 1rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.food-grid-card {
    height: 100%;
    border: 1px solid var(--fi-card-border);
    border-radius: 18px;
    background: #fff;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
    box-shadow: 0 6px 18px rgba(16, 24, 40, .04);
}

.food-grid-card__media {
    display: block;
    border-radius: 16px;
    overflow: hidden;
    background: linear-gradient(135deg, #f3f7ff 0%, #eef8f1 100%);
}

.food-grid-card [data-compare-id],
.food-hero [data-compare-id],
.table-compare [data-compare-id] {
    position: relative;
    z-index: 3;
    pointer-events: auto;
    flex-shrink: 0;
}

.food-grid-card__image,
.food-hero__image {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    display: block;
}

.food-photo-panel {
    overflow: hidden;
}

.autocomplete-item__thumb {
    width: 72px;
    height: 72px;
    border-radius: 14px;
    object-fit: cover;
    flex: 0 0 auto;
    background: linear-gradient(135deg, #f3f7ff 0%, #eef8f1 100%);
}

.autocomplete-item__body {
    min-width: 0;
    flex: 1 1 auto;
}

.food-grid-card:hover,
.category-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(16, 24, 40, .10);
    border-color: #d4e3ff;
}

.category-tile {
    display: block;
    height: 100%;
    padding: 1.1rem;
    border: 1px solid var(--fi-card-border);
    border-radius: 18px;
    background: #fff;
    transition: all .2s ease;
}

.compare-dock {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1080;
    width: min(360px, calc(100vw - 24px));
}

.compare-dock__inner {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--fi-card-border);
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(16, 24, 40, .18);
    backdrop-filter: blur(8px);
    padding: 1rem;
}

.compare-dock__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .75rem;
}

.compare-dock__title {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.2;
}

.compare-dock__subtitle,
.compare-dock__empty {
    color: var(--fi-text-soft);
    font-size: .9rem;
}

.compare-dock__items {
    display: grid;
    gap: .55rem;
    margin-bottom: .9rem;
}

.compare-dock__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .55rem .7rem;
    border-radius: 12px;
    background: #f8fafc;
}

.compare-dock__item-text {
    font-size: .92rem;
    line-height: 1.3;
}

.compare-dock__remove {
    border: 0;
    background: transparent;
    color: #dc3545;
    font-size: 1.35rem;
    line-height: 1;
    padding: 0;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
}

@media (max-width: 575.98px) {
    .compare-dock {
        right: 12px;
        left: 12px;
        width: auto;
        bottom: 12px;
    }
}

.metric-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .4rem .7rem;
    border-radius: 999px;
    background: #f4f7fb;
    color: #344054;
    font-size: .875rem;
    font-weight: 600;
}

.metric-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}

.metric-label {
    color: var(--fi-text-soft);
    font-size: .9rem;
}

.food-hero {
    background: linear-gradient(180deg, #f9fbff 0%, #ffffff 100%);
    border-bottom: 1px solid #edf2fb;
}

.food-name {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 800;
    line-height: 1.15;
}

.summary-badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .8rem;
    border-radius: 999px;
    background: #f3f7ff;
    color: #294172;
    font-weight: 600;
    font-size: .9rem;
}

.note-good { background: var(--fi-success-soft); color: #146c43; }
.note-bad { background: var(--fi-danger-soft); color: #b42318; }
.note-warn { background: var(--fi-warning-soft); color: #9a6700; }

.nutrient-row {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(100px, .7fr) minmax(70px, .4fr);
    gap: 1rem;
    align-items: center;
    padding: .8rem 0;
    border-bottom: 1px solid #edf1f7;
}

.nutrient-row:last-child { border-bottom: 0; }

.nutrient-progress {
    height: .55rem;
    border-radius: 999px;
    background: #edf2f7;
    overflow: hidden;
}

.nutrient-progress > span {
    display: block;
    height: 100%;
    border-radius: inherit;
}

.autocomplete-dropdown {
    position: absolute;
    inset: calc(100% + 6px) 0 auto 0;
    z-index: 1000;
    background: #fff;
    border: 1px solid var(--fi-card-border);
    border-radius: 14px;
    box-shadow: 0 15px 45px rgba(16, 24, 40, .12);
    overflow: hidden;
    min-width: 320px;
}

#headerSearchForm { position: relative; }

.autocomplete-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .85rem 1rem;
    border-bottom: 1px solid #f2f4f7;
    color: inherit;
}

.autocomplete-item:last-child { border-bottom: 0; }
.autocomplete-item:hover { background: #f8fbff; }

.site-footer {
    background: #fcfdff;
}

.footer-links li + li { margin-top: .5rem; }
.footer-links a { color: #475467; }
.footer-links a:hover { color: var(--fi-primary-dark); }

.page-hero {
    padding: 2.5rem 0 1.5rem;
    background: linear-gradient(180deg, #f9fbff 0%, #ffffff 100%);
    border-bottom: 1px solid #edf2fb;
}

.btn-scroll-top {
    position: fixed;
    right: 20px;
    bottom: 20px;
    border-radius: 999px;
    width: 46px;
    height: 46px;
    z-index: 1040;
}

.compare-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 .4rem;
    border-radius: 999px;
    background: #ffc107;
    color: #4a2f00;
    font-size: .75rem;
    font-weight: 800;
    line-height: 1;
}

.compare-table-wrap {
    overflow-x: auto;
}

.table-compare {
    min-width: max-content;
}

.table-compare th,
.table-compare td {
    vertical-align: middle;
    white-space: nowrap;
}

.table-compare .compare-metric-col {
    position: sticky;
    left: 0;
    z-index: 2;
    min-width: 220px;
    background: #fff;
    box-shadow: 1px 0 0 #edf2f7;
}

.table-compare thead .compare-metric-col {
    z-index: 3;
}

.table-compare .compare-food-col {
    min-width: 240px;
}

.table-compare .compare-section-row th {
    position: sticky;
    left: 0;
    z-index: 1;
    background: #f8f9fa;
}

.mini-muted {
    color: var(--fi-text-soft);
    font-size: .875rem;
}

.cookie-consent {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: min(380px, calc(100vw - 24px));
    padding: 1rem;
    background: #ffffff;
    border: 1px solid var(--fi-card-border);
    border-radius: 18px;
    box-shadow: 0 20px 40px rgba(16, 24, 40, .16);
    z-index: 1050;
}

.cookie-consent__title {
    font-weight: 700;
    margin-bottom: .35rem;
}

.cookie-consent__text {
    color: var(--fi-text-soft);
    font-size: .95rem;
}

.contact-honeypot {
    position: absolute !important;
    left: -9999px !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

@media (max-width: 991.98px) {
    .nutrient-row {
        grid-template-columns: 1fr;
        gap: .35rem;
    }

    .autocomplete-dropdown {
        min-width: 100%;
    }

    .cookie-consent {
        right: 12px;
        bottom: 12px;
        width: calc(100vw - 24px);
    }
}


.circle-metric-card {
    border: 1px solid var(--fi-card-border);
    border-radius: 18px;
    background: #fff;
    padding: 1rem;
    box-shadow: 0 6px 18px rgba(16, 24, 40, .04);
}

.circle-metric__chart {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: conic-gradient(var(--circle-color, var(--fi-primary)) calc(var(--circle-percent, 0) * 1%), #edf2f7 0);
    display: grid;
    place-items: center;
}

.circle-metric__inner {
    width: 82px;
    height: 82px;
    border-radius: 50%;
    background: #fff;
    display: grid;
    place-items: center;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.05);
}

.circle-metric__percent {
    font-size: 1.1rem;
    font-weight: 800;
    color: #101828;
}

.circle-metric__value {
    font-weight: 700;
    margin-bottom: .25rem;
}
