@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700;800&display=swap');

:root {
    color-scheme: light;
    --forest-950: #0d3526;
    --forest-900: #12452f;
    --forest-800: #175c3d;
    --forest-700: #24744c;
    --forest-600: #2e8a57;
    --forest-100: #ddf3e6;
    --forest-50: #f0faf4;
    --orange-600: #e87d24;
    --orange-100: #ffecd9;
    --blue-600: #3975bd;
    --blue-100: #e5f0ff;
    --red-600: #c94a42;
    --red-100: #ffe9e7;
    --ink-900: #17241d;
    --ink-700: #405049;
    --ink-500: #708078;
    --line: #dce6df;
    --line-strong: #c9d8ce;
    --surface: #ffffff;
    --surface-soft: #f5f8f5;
    --page: #eef3ef;
    --shadow: 0 18px 48px rgba(19, 65, 44, .11);
    --shadow-soft: 0 8px 24px rgba(19, 65, 44, .08);
    --radius-xl: 26px;
    --radius-lg: 18px;
    --radius-md: 13px;
    --content-width: 1240px;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 10% 0%, rgba(74, 153, 96, .10), transparent 28rem),
        var(--page);
    color: var(--ink-900);
    font-family: 'Be Vietnam Pro', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.45;
    padding-bottom: 108px;
}

button,
input,
select {
    font: inherit;
}

button,
select {
    cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
.export-option:focus-within {
    outline: 3px solid rgba(46, 138, 87, .25);
    outline-offset: 2px;
}

[hidden] {
    display: none !important;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.page-shell {
    min-height: 100vh;
}

.hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: 248px;
    color: white;
    background:
        linear-gradient(125deg, rgba(10, 45, 31, .98), rgba(30, 104, 65, .95)),
        #174f37;
    padding: 42px max(24px, calc((100vw - var(--content-width)) / 2 + 24px)) 76px;
}

.hero::after {
    content: '';
    position: absolute;
    inset: auto -8% -130px auto;
    width: 440px;
    height: 440px;
    border-radius: 50%;
    border: 78px solid rgba(255, 255, 255, .035);
    z-index: -1;
}

.hero__pattern {
    position: absolute;
    inset: 0;
    z-index: -1;
    opacity: .16;
    background-image:
        linear-gradient(30deg, transparent 12%, rgba(255,255,255,.16) 12.5%, transparent 13%),
        linear-gradient(150deg, transparent 12%, rgba(255,255,255,.1) 12.5%, transparent 13%);
    background-size: 72px 72px;
    mask-image: linear-gradient(90deg, black, transparent 80%);
}

.hero__content {
    display: flex;
    align-items: center;
    gap: 22px;
    max-width: var(--content-width);
    margin: 0 auto;
}

.brand-mark {
    display: grid;
    place-items: center;
    flex: 0 0 76px;
    width: 76px;
    height: 76px;
    border-radius: 23px;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.2);
    box-shadow: inset 0 1px rgba(255,255,255,.22);
    font-size: 39px;
    backdrop-filter: blur(8px);
}

.eyebrow,
.section-kicker {
    margin: 0 0 5px;
    color: #b8e0c9;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .16em;
}

.hero h1,
.section-heading h2,
.export-dialog h2 {
    margin: 0;
    line-height: 1.18;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.2rem);
    letter-spacing: -.045em;
}

.hero__subtitle {
    max-width: 650px;
    margin: 9px 0 0;
    color: rgba(255,255,255,.78);
    font-size: .98rem;
}

.hero__status {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    max-width: var(--content-width);
    margin: 26px auto 0;
    padding: 9px 13px;
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 999px;
    color: rgba(255,255,255,.77);
    background: rgba(0,0,0,.12);
    font-size: .76rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #73e49e;
    box-shadow: 0 0 0 5px rgba(115,228,158,.13);
}

.content {
    width: min(calc(100% - 32px), var(--content-width));
    margin: -42px auto 0;
    position: relative;
    z-index: 2;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.summary-card {
    display: flex;
    align-items: center;
    gap: 15px;
    min-height: 112px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid rgba(217, 230, 221, .95);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.summary-card__icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 16px;
    font-weight: 800;
    font-size: 1.25rem;
}

.summary-card--green .summary-card__icon { color: var(--forest-700); background: var(--forest-100); }
.summary-card--orange .summary-card__icon { color: var(--orange-600); background: var(--orange-100); }
.summary-card--blue .summary-card__icon { color: var(--blue-600); background: var(--blue-100); }

.summary-card__label {
    display: block;
    margin-bottom: 3px;
    color: var(--ink-500);
    font-size: .77rem;
    font-weight: 600;
}

.summary-card strong {
    display: block;
    font-size: 1.65rem;
    line-height: 1.1;
    letter-spacing: -.035em;
}

.summary-card strong small {
    color: var(--ink-500);
    font-size: .82rem;
    font-weight: 600;
    letter-spacing: 0;
}

.filter-panel,
.food-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
}

.filter-panel {
    padding: 23px;
    margin-bottom: 20px;
    border-radius: var(--radius-xl);
}

.food-panel {
    overflow: hidden;
    border-radius: var(--radius-xl);
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 19px;
}

.section-heading h2,
.export-dialog h2 {
    font-size: 1.25rem;
    letter-spacing: -.025em;
}

.section-kicker {
    color: var(--forest-600);
}

.filters {
    display: grid;
    grid-template-columns: minmax(220px, 1.45fr) repeat(5, minmax(130px, 1fr));
    gap: 13px;
}

.field {
    display: grid;
    align-content: end;
    gap: 7px;
    min-width: 0;
}

.field > span {
    color: var(--ink-700);
    font-size: .72rem;
    font-weight: 700;
}

.field input,
.field select {
    width: 100%;
    height: 45px;
    color: var(--ink-900);
    background: #fbfdfb;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    padding: 0 12px;
    transition: border-color .18s, box-shadow .18s, background .18s;
}

.field input:hover,
.field select:hover {
    border-color: #a9c1b1;
}

.field input:focus,
.field select:focus {
    outline: none;
    background: white;
    border-color: var(--forest-600);
    box-shadow: 0 0 0 4px rgba(46,138,87,.11);
}

.input-wrap {
    position: relative;
}

.input-wrap input {
    padding-left: 39px;
    padding-right: 38px;
}

.input-icon {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    color: var(--ink-500);
    pointer-events: none;
}

.clear-search {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 29px;
    height: 29px;
    border: 0;
    border-radius: 50%;
    color: var(--ink-500);
    background: transparent;
    font-size: 1.2rem;
}

.clear-search:hover { background: var(--surface-soft); color: var(--ink-900); }

.level-range {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 7px;
}

.range-separator {
    color: var(--ink-500);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-weight: 700;
    font-size: .8rem;
    white-space: nowrap;
    transition: transform .15s, background .15s, border-color .15s, box-shadow .15s;
}

.button:active { transform: translateY(1px) scale(.99); }
.button:disabled { opacity: .55; cursor: not-allowed; }
.button--ghost { color: var(--ink-700); background: white; border-color: var(--line-strong); }
.button--ghost:hover { border-color: var(--forest-600); color: var(--forest-700); background: var(--forest-50); }
.button--primary { color: white; background: var(--forest-700); }
.button--danger-soft { color: var(--red-600); background: var(--red-100); }
.button--danger-soft:hover { background: #ffddda; }
.button--export {
    min-height: 48px;
    color: white;
    background: linear-gradient(135deg, var(--forest-600), var(--forest-800));
    box-shadow: 0 8px 20px rgba(25,104,65,.24);
}
.button--export:hover { box-shadow: 0 10px 28px rgba(25,104,65,.31); transform: translateY(-1px); }

.food-heading {
    margin: 0;
    padding: 22px 23px;
    border-bottom: 1px solid var(--line);
}

.food-heading__actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.result-badge {
    padding: 8px 12px;
    border-radius: 999px;
    color: var(--forest-700);
    background: var(--forest-50);
    font-size: .75rem;
    font-weight: 600;
}

.food-table__head,
.food-row {
    display: grid;
    grid-template-columns: 92px minmax(270px, 1.5fr) minmax(150px, .7fr) minmax(220px, .8fr);
    align-items: center;
}

.food-table__head {
    min-height: 48px;
    padding: 0 20px;
    color: var(--ink-500);
    background: #f8faf8;
    border-bottom: 1px solid var(--line);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.food-row {
    min-height: 91px;
    padding: 10px 20px;
    background: white;
    border-bottom: 1px solid #e8eee9;
    transition: background .16s, box-shadow .16s;
}

.food-row:last-child { border-bottom: 0; }
.food-row:hover { background: #fbfdfb; box-shadow: inset 4px 0 var(--forest-100); }
.food-row--filled { background: #fbfefc; }
.food-row--filled .food-icon-wrap { box-shadow: 0 0 0 3px rgba(46,138,87,.14); }

.food-cell {
    min-width: 0;
}

.food-icon-wrap {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    overflow: hidden;
    border: 1px solid #d8e5db;
    border-radius: 18px;
    background: var(--surface-soft);
    transition: box-shadow .18s;
}

.food-icon {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.food-icon-wrap--error::after {
    content: '🍽️';
    font-size: 30px;
}

.food-cell--identity {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-right: 18px;
}

.level-badge {
    flex: 0 0 auto;
    min-width: 51px;
    padding: 7px 8px;
    border-radius: 10px;
    color: var(--forest-800);
    background: var(--forest-100);
    font-size: .69rem;
    font-weight: 800;
    text-align: center;
}

.level-badge--none {
    color: #805318;
    background: #fff0d6;
}

.food-cell--identity h3 {
    overflow: hidden;
    margin: 0 0 3px;
    font-size: .95rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.food-code {
    display: block;
    overflow: hidden;
    color: var(--ink-500);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .67rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.category-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    max-width: 100%;
    min-height: 31px;
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink-700);
    background: #fafcfb;
    font-size: .7rem;
    font-weight: 600;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.quantity-control {
    display: grid;
    grid-template-columns: 40px minmax(80px, 118px) 40px;
    align-items: stretch;
    width: max-content;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: 13px;
    background: white;
    box-shadow: 0 4px 12px rgba(27,69,48,.05);
}

.quantity-button {
    border: 0;
    color: var(--forest-800);
    background: var(--forest-50);
    font-size: 1.25rem;
    font-weight: 700;
    transition: background .15s;
}

.quantity-button:hover { background: var(--forest-100); }
.quantity-button:active { background: #ccebd8; }

.quantity-control label {
    border-inline: 1px solid var(--line);
}

.quantity-input {
    width: 100%;
    height: 44px;
    padding: 0 7px;
    border: 0;
    outline: 0;
    color: var(--ink-900);
    background: white;
    font-weight: 800;
    text-align: center;
    appearance: textfield;
}

.quantity-input::-webkit-inner-spin-button,
.quantity-input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.quantity-input:focus { background: #fbfffc; box-shadow: inset 0 0 0 2px var(--forest-600); }

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 15px 20px 19px;
    border-top: 1px solid var(--line);
    background: #fff;
}

.pagination__info {
    margin: 0;
    color: var(--ink-500);
    font-size: .72rem;
    font-weight: 600;
    white-space: nowrap;
}

.pagination__controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    min-width: 0;
}

.pagination__pages {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination__arrow,
.pagination__page {
    display: inline-grid;
    place-items: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    color: var(--ink-700);
    background: white;
    font-size: .72rem;
    font-weight: 700;
    transition: color .15s, background .15s, border-color .15s;
}

.pagination__arrow:hover:not(:disabled),
.pagination__page:hover {
    color: var(--forest-700);
    border-color: var(--forest-600);
    background: var(--forest-50);
}

.pagination__arrow:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.pagination__page--active {
    color: white;
    border-color: var(--forest-700);
    background: var(--forest-700);
}

.pagination__page--active:hover {
    color: white;
    border-color: var(--forest-800);
    background: var(--forest-800);
}

.pagination__ellipsis {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 34px;
    color: var(--ink-500);
    font-weight: 800;
}

.empty-state {
    padding: 70px 20px;
    text-align: center;
}

.empty-state__icon { font-size: 43px; }
.empty-state h3 { margin: 10px 0 4px; }
.empty-state p { margin: 0 0 18px; color: var(--ink-500); }

.notice {
    margin: 20px;
    padding: 18px;
    border-radius: var(--radius-md);
}
.notice--error { color: #8d2f2a; background: var(--red-100); }

.export-bar {
    position: fixed;
    z-index: 20;
    left: 50%;
    bottom: max(14px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 26px;
    width: min(calc(100% - 32px), 720px);
    padding: 12px 13px 12px 20px;
    border: 1px solid rgba(204,220,209,.95);
    border-radius: 20px;
    background: rgba(255,255,255,.94);
    box-shadow: 0 20px 60px rgba(13,53,38,.22);
    backdrop-filter: blur(18px);
}

.export-bar__summary {
    display: grid;
    grid-template-columns: auto auto;
    align-items: baseline;
    column-gap: 9px;
}

.export-bar__summary span {
    grid-column: 1 / 3;
    color: var(--ink-500);
    font-size: .67rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.export-bar__summary strong {
    color: var(--forest-800);
    font-size: 1.55rem;
    line-height: 1;
}

.export-bar__summary small {
    color: var(--ink-500);
    font-size: .68rem;
}

.export-dialog {
    width: min(calc(100% - 28px), 560px);
    max-height: calc(100vh - 28px);
    padding: 0;
    overflow: auto;
    border: 0;
    border-radius: 24px;
    box-shadow: 0 30px 90px rgba(7,35,23,.3);
}

.export-dialog::backdrop {
    background: rgba(7,31,21,.62);
    backdrop-filter: blur(5px);
}

.export-dialog__card {
    padding: 24px;
}

.export-dialog__header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 13px;
    margin-bottom: 20px;
}

.export-dialog__icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 15px;
    color: white;
    background: var(--forest-700);
    font-size: .67rem;
    font-weight: 800;
}

.dialog-close {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    color: var(--ink-500);
    background: var(--surface-soft);
    font-size: 1.35rem;
}

.export-group-field,
.export-language-field {
    margin-bottom: 16px;
}

.export-options {
    display: grid;
    gap: 10px;
}

.export-option {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.export-option input { position: absolute; opacity: 0; pointer-events: none; }
.export-option--active { border-color: var(--forest-600); background: var(--forest-50); }

.radio-mark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--line-strong);
    border-radius: 50%;
    box-shadow: inset 0 0 0 4px white;
    background: white;
}

.export-option--active .radio-mark {
    border-color: var(--forest-600);
    background: var(--forest-600);
}

.export-option strong,
.export-option small { display: block; }
.export-option strong { margin-bottom: 3px; font-size: .85rem; }
.export-option small { color: var(--ink-500); font-size: .7rem; }

.export-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    padding: 13px 14px;
    border-radius: 12px;
    color: var(--ink-700);
    background: var(--surface-soft);
    font-size: .76rem;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.toast {
    position: fixed;
    z-index: 50;
    left: 50%;
    bottom: 106px;
    transform: translate(-50%, 16px);
    max-width: min(90vw, 460px);
    padding: 11px 16px;
    border-radius: 999px;
    color: white;
    background: var(--forest-950);
    box-shadow: 0 12px 34px rgba(0,0,0,.2);
    font-size: .76rem;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
}

.toast--show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1050px) {
    .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .field--search { grid-column: 1 / -1; }
    .food-table__head,
    .food-row { grid-template-columns: 82px minmax(240px, 1.5fr) minmax(130px, .7fr) minmax(205px, .8fr); }
    .food-table { overflow-x: auto; }
    .food-table__head,
    .food-row { min-width: 770px; }
}

@media (max-width: 720px) {
    body { padding-bottom: 116px; }
    .hero { min-height: 236px; padding: 30px 20px 70px; }
    .hero__content { align-items: flex-start; }
    .brand-mark { flex-basis: 60px; width: 60px; height: 60px; border-radius: 18px; font-size: 30px; }
    .hero__subtitle { font-size: .84rem; }
    .hero__status { margin-top: 20px; }
    .content { width: min(calc(100% - 20px), var(--content-width)); }
    .summary-grid { grid-template-columns: 1fr; gap: 9px; }
    .summary-card { min-height: 82px; padding: 14px 16px; }
    .summary-card__icon { width: 46px; height: 46px; border-radius: 13px; }
    .summary-card strong { font-size: 1.35rem; }
    .filter-panel { padding: 18px 14px; border-radius: 20px; }
    .section-heading { align-items: flex-start; }
    .filters { grid-template-columns: 1fr; }
    .field--search { grid-column: auto; }
    .food-panel { border-radius: 20px; }
    .pagination {
        align-items: stretch;
        flex-direction: column;
        padding: 14px;
    }
    .pagination__info {
        text-align: center;
    }
    .pagination__controls {
        justify-content: center;
        flex-wrap: wrap;
    }
    .pagination__arrow {
        min-width: 76px;
    }
    .food-heading { align-items: flex-start; padding: 18px 14px; }
    .food-heading__actions { flex-direction: column; align-items: flex-end; }
    .food-table__head { display: none; }
    .food-table { overflow: visible; }
    .food-row {
        position: relative;
        grid-template-columns: 66px minmax(0, 1fr);
        grid-template-areas:
            'icon identity'
            'category category'
            'quantity quantity';
        gap: 11px 12px;
        min-width: 0;
        min-height: 0;
        padding: 15px 13px;
    }
    .food-cell--icon { grid-area: icon; }
    .food-cell--identity { grid-area: identity; padding: 0; }
    .food-cell--category {
        grid-area: category;
        align-self: center;
        justify-self: start;
        min-width: 0;
    }
    .food-cell--quantity {
        grid-area: quantity;
        justify-self: end;
    }
    .food-icon-wrap { width: 60px; height: 60px; border-radius: 16px; }
    .food-cell--identity { align-items: flex-start; flex-direction: column; gap: 6px; }
    .level-badge { min-width: 46px; padding: 5px 7px; }
    .level-badge--none {
    color: #805318;
    background: #fff0d6;
}

.food-cell--identity h3 { white-space: normal; }
    .category-chip {
        max-width: 100%;
        white-space: normal;
        text-align: center;
    }
    .quantity-control { grid-template-columns: 38px 76px 38px; }
    .export-bar { width: calc(100% - 20px); gap: 10px; padding: 10px 10px 10px 15px; }
    .export-bar .button { padding-inline: 13px; }
    .export-dialog__card { padding: 19px 15px; }
}

@media (max-width: 420px) {
    .hero__content { gap: 13px; }
    .brand-mark { flex-basis: 52px; width: 52px; height: 52px; font-size: 26px; }
    .hero h1 { font-size: 1.75rem; }
    .food-heading__actions .button { min-height: 36px; padding-inline: 10px; font-size: .7rem; }
    .quantity-control { grid-template-columns: 35px 67px 35px; }
    .quantity-input { height: 41px; }
    .export-bar__summary strong { font-size: 1.3rem; }
    .export-bar .button { font-size: .72rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}
