@font-face {
  font-family: Inter;
  src: url("/assets/fonts/inter-cyrillic.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: Inter;
  src: url("/assets/fonts/inter-latin.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --page: #f7f8f4;
  --paper: #fff;
  --ink: #18241d;
  --muted: #53635a;
  --line: #e4e9e1;
  --forest: #14251d;
  --forest-hover: #243b2d;
  --green: #24593d;
  --green-strong: #1b4730;
  --green-light: #eaf3e7;
  --lime: #e1f0ac;
  --amber: #965615;
  --radius: 19px;
  --shadow: 0 2px 6px #223d2010;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--page); color: var(--ink); font: 14px/1.5 Inter, "Segoe UI", sans-serif; }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { opacity: .56; cursor: wait; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid #387b50; outline-offset: 3px; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; vertical-align: middle; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: fixed; z-index: 10; top: 10px; left: 10px; padding: 9px 15px; background: var(--paper); border-radius: 8px; }

.sidebar { position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; width: 228px; background: var(--forest); color: #f5faf4; z-index: 3; padding: 30px 16px 19px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 9px; }
.brand-mark { display: grid; place-items: center; width: 43px; height: 43px; border-radius: 13px; background: var(--lime); color: #24402c; }
.brand-mark .icon { width: 24px; height: 24px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 22px; line-height: 1.1; letter-spacing: -.055em; font-weight: 750; }
.brand small { color: #b0c2b4; margin-top: 3px; font-size: 11px; font-weight: 550; }
.navigation { display: grid; gap: 5px; margin-top: 47px; }
.navigation a, .sidebar-footer a { display: flex; align-items: center; gap: 12px; min-height: 45px; padding: 10px 12px; border-radius: 10px; color: #b8cbbd; white-space: nowrap; font-size: 13px; font-weight: 550; }
.navigation a:hover, .sidebar-footer a:hover { background: var(--forest-hover); color: #fff; }
.navigation a[aria-current="page"] { background: #2d4735; color: #f3f9e5; }
.navigation a[aria-current="page"] .icon { color: var(--lime); }
.sidebar-footer { margin-top: auto; border-top: 1px solid #ffffff20; padding-top: 11px; }
.sidebar-footer a { min-height: 40px; }
.sidebar-footer .outbound { margin-left: auto; }
.sidebar-footer .outbound .icon { width: 13px; height: 13px; }
.sidebar-status { display: flex; align-items: center; gap: 8px; color: #b8cbbd; padding: 8px 12px 4px; font-size: 11px; }
.sidebar-status i, .network i { width: 8px; height: 8px; border-radius: 50%; background: #d4a458; }
body[data-online="true"] .sidebar-status i, body[data-online="true"] .network i { background: #62a879; box-shadow: 0 0 0 3px #62a87924; }

.workspace { margin-left: 228px; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 66px; padding: 10px clamp(23px, 3.1vw, 48px); border-bottom: 1px solid var(--line); background: var(--paper); gap: 12px; }
.breadcrumb { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.breadcrumb strong { color: var(--ink); font-weight: 620; }
.breadcrumb .icon { width: 13px; height: 13px; color: #7d8a81; }
.network { display: flex; align-items: center; gap: 9px; color: var(--green-strong); background: #eff5eb; border: 1px solid #dce9d9; border-radius: 24px; padding: 5px 11px; white-space: nowrap; font-size: 11px; font-weight: 620; }
.content { max-width: 1510px; margin: 0 auto; padding: 30px clamp(23px, 3.1vw, 48px) 0; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 23px; }
.page-heading h1 { font-size: clamp(32px, 3vw, 43px); line-height: 1.08; letter-spacing: -.052em; font-weight: 760; }
.page-heading p, .section-heading p { margin-top: 7px; color: var(--muted); }
.heading-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.section-heading h2 { font-size: 23px; font-weight: 730; letter-spacing: -.037em; }
.section-heading p { margin-top: 4px; font-size: 13px; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 43px; padding: 9px 14px; border: 1px solid transparent; border-radius: 10px; white-space: nowrap; font-size: 13px; font-weight: 650; transition: background .16s, border-color .16s, color .16s; }
.button .icon { width: 16px; height: 16px; }
.primary { background: var(--green); color: white; }
.primary:hover { background: var(--green-strong); }
.secondary { background: var(--paper); border-color: #dce4db; color: var(--ink); }
.secondary:hover { background: #f2f7ef; border-color: #b7cbb7; }
.compact { min-height: 35px; padding: 6px 10px; font-size: 12px; }
.text-link { display: inline-flex; align-items: center; gap: 7px; color: var(--green); font-size: 13px; font-weight: 670; }
.text-link:hover { text-decoration: underline; }
.text-link .icon { width: 15px; height: 15px; }
.icon-button { display: grid; place-items: center; width: 36px; height: 36px; background: var(--page); color: var(--muted); border: 1px solid var(--line); border-radius: 9px; }
.icon-button:hover { background: var(--green-light); color: var(--ink); }

.analysis-grid { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); align-items: start; gap: 18px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); min-width: 0; }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 19px 16px; }
.card-title { display: flex; align-items: center; gap: 11px; min-width: 0; }
.card-title h2 { font-size: 16px; letter-spacing: -.027em; font-weight: 720; }
.card-title p { color: var(--muted); font-size: 11.5px; margin-top: 2px; overflow-wrap: anywhere; }
.icon-box { display: grid; flex: 0 0 38px; height: 38px; place-items: center; background: #ecf3e9; border-radius: 10px; color: var(--green); }
.icon-box .icon { width: 19px; height: 19px; }
.photo-stage { position: relative; display: grid; place-items: center; margin: 0 18px; height: clamp(255px, 29vw, 355px); overflow: hidden; border-radius: 13px; background: #e6ebe2; color: var(--muted); isolation: isolate; }
.photo-stage img { width: 100%; height: 100%; object-fit: contain; position: absolute; inset: 0; background: #e4e9e1; }
.photo-stage.dragging { box-shadow: inset 0 0 0 3px #67a77a; background: #dbeada; }
.empty-photo { display: grid; justify-items: center; text-align: center; padding: 15px; gap: 5px; }
.empty-photo strong, .empty-results strong { color: var(--ink); font-weight: 680; }
.empty-photo > span:last-child { font-size: 12px; }
.empty-camera { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; margin-bottom: 7px; color: var(--green); background: #dce9db; }
.empty-camera .icon { width: 24px; height: 24px; }
.view-chip { position: absolute; top: 12px; left: 12px; display: flex; align-items: center; gap: 6px; border-radius: 7px; padding: 5px 8px; background: #17261eea; color: #fff; font-size: 11px; font-weight: 580; }
.view-chip .icon { width: 14px; height: 14px; }
.photo-tools { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 2px; padding: 3px; border-radius: 9px; background: #17261eed; color: #e6f0e7; }
.photo-tools button { border: 0; border-radius: 6px; padding: 5px 12px; color: inherit; background: none; font-size: 11px; font-weight: 640; }
.photo-tools button[aria-pressed="true"] { color: var(--ink); background: #f1f7ed; }
.analysis-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px; padding: 14px 18px 18px; }
.weight-field label { display: block; font-size: 12px; font-weight: 650; margin: 0 0 5px; }
.weight-input, .search-input { display: flex; align-items: center; gap: 9px; padding: 0 11px; background: #f9faf7; border: 1px solid #dfe7dd; border-radius: 10px; min-height: 43px; }
.weight-input:focus-within, .search-input:focus-within { outline: 2px solid #699976; outline-offset: -1px; }
.weight-input .icon, .search-input .icon { color: #60806a; }
.weight-input input, .search-input input { border: 0; background: transparent; min-width: 0; width: 100%; outline: none; color: var(--ink); }
.weight-input input { font-size: 17px; font-weight: 720; appearance: textfield; font-variant-numeric: tabular-nums; }
.weight-input input::-webkit-inner-spin-button, .weight-input input::-webkit-outer-spin-button { appearance: none; }
.weight-input > span:last-child { color: var(--muted); font-size: 12px; }
.form-error { color: #9e351f; font-size: 12px; grid-column: 1 / -1; }
.angle-check { display: flex; align-items: center; gap: 6px; grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.angle-check input { accent-color: var(--green); }
#mixed-version-field { flex-wrap: wrap; gap: 7px 10px; }
#mixed-version { max-width: 100%; min-height: 38px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--page); color: var(--ink); font: inherit; }
#mixed-version:focus-visible { outline: 2px solid #699976; outline-offset: 2px; }
.loading .icon { opacity: .68; }

.results-card { min-height: clamp(426px, 44vw, 523px); display: flex; flex-direction: column; }
.empty-results { flex: 1; display: grid; place-content: center; justify-items: center; text-align: center; gap: 7px; padding: 28px; }
.empty-results p { color: var(--muted); font-size: 13px; max-width: 260px; }
.result-body { padding: 0 18px 16px; min-width: 0; }
.pill { display: inline-flex; align-items: center; border-radius: 20px; padding: 5px 9px; background: #ecf3e9; color: var(--green-strong); white-space: nowrap; font-size: 10.5px; font-weight: 700; }
.summary-card { display: grid; grid-template-columns: 1.15fr 1fr; gap: 14px; padding: 13px 14px; min-height: 100px; border-radius: 13px; background: #eaf3e6; }
.energy { display: flex; flex-direction: column; justify-content: center; align-items: start; gap: 3px; }
.energy > span { font-size: 11px; color: #3c6348; font-weight: 670; }
.energy strong { font-size: clamp(31px, 3.3vw, 42px); line-height: 1.05; font-weight: 760; letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.energy div > span { font-size: 12px; color: #42664d; }
.macros { display: grid; align-content: center; gap: 5px; border-left: 1px solid #d2e1cf; padding-left: 12px; }
.macros div { display: grid; grid-template-columns: 7px 1fr auto; align-items: center; gap: 6px; font-size: 11px; color: #35513d; }
.macros strong { color: var(--ink); font-weight: 730; white-space: nowrap; }
.macros i { width: 7px; height: 7px; border-radius: 50%; }
.macro-protein { background: #548e60; }
.macro-fat { background: #be8340; }
.macro-carbs { background: #7294bd; }
.ingredient-head, .ingredient-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(51px, .34fr) minmax(42px, .25fr); align-items: center; gap: 6px; }
.ingredient-head { padding: 12px 6px 7px 0; color: var(--muted); font-size: 11px; font-weight: 650; border-bottom: 1px solid var(--line); }
.ingredient-head > :not(:first-child), .ingredient-row > :not(:first-child) { text-align: right; }
.ingredient-row { min-height: 39px; padding: 5px 0; border-bottom: 1px solid #edf0eb; font-size: 12px; font-variant-numeric: tabular-nums; }
.ingredient-rows { max-height: 275px; overflow: auto; scrollbar-width: thin; }
.ingredient-name { display: flex; align-items: start; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
.ingredient-name i { width: 9px; height: 9px; margin-top: 5px; flex: 0 0 9px; border-radius: 50%; background: var(--dot, #a6b2a8); }
.ingredient-name strong { font-weight: 650; }
.ingredient-grams { font-weight: 680; white-space: nowrap; }
.ingredient-kcal { color: var(--muted); }
.result-footer { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding-top: 11px; }
.result-footer p { flex: 1 1 168px; color: var(--muted); font-size: 11.25px; line-height: 1.5; }

.ground-truth { margin-top: 17px; }
.truth-content { display: grid; grid-template-columns: 1.15fr 1fr; gap: 21px; padding: 0 18px 15px; }
.truth-content h3 { font-size: 13px; margin-bottom: 6px; }
.truth-content details { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 9px; color: var(--muted); font-size: 12px; }
.truth-content summary { cursor: pointer; font-weight: 630; color: var(--green-strong); }
.truth-content .truth-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px 12px; padding-top: 9px; }
.truth-pair { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; padding: 4px 0; }
.truth-pair > :last-child { white-space: nowrap; font-variant-numeric: tabular-nums; }
.truth-metric { min-height: 75px; padding: 12px; border-radius: 11px; background: #f4f7ef; }
.truth-metric p { color: var(--muted); font-size: 11.5px; margin-top: 5px; }

.examples-section { margin-top: 24px; }
.examples-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.example { width: 100%; overflow: hidden; padding: 0; text-align: left; color: var(--ink); border: 1px solid var(--line); background: var(--paper); border-radius: 14px; box-shadow: var(--shadow); transition: border-color .16s, box-shadow .16s; }
.example:hover { border-color: #8fb294; box-shadow: 0 4px 10px #253d2521; }
.example.selected { border-color: #77a383; }
.example img { width: 100%; height: clamp(100px, 13vw, 151px); object-fit: cover; object-position: center 50%; background: #eef1ea; }
.example-text { display: block; padding: 9px 11px 10px; }
.example-text strong { display: block; color: var(--ink); font-size: 13px; font-weight: 700; letter-spacing: -.012em; }
.example-meta { display: flex; align-items: center; justify-content: space-between; gap: 4px 6px; flex-wrap: wrap; color: var(--muted); font-size: 11px; margin-top: 3px; }
.example-meta b { color: var(--green-strong); white-space: nowrap; font-weight: 670; }
.footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 5px 20px; color: var(--muted); margin-top: 28px; border-top: 1px solid var(--line); padding: 12px 0 18px; font-size: 11px; }
.footer a:hover { text-decoration: underline; }

.table-card { padding: 17px; }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
th { padding: 10px 9px; text-align: left; color: var(--muted); font-size: 11px; font-weight: 680; border-bottom: 1px solid var(--line); }
td { padding: 9px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.history-title { display: flex; align-items: center; gap: 9px; min-width: 155px; }
.history-title img { width: 46px; height: 37px; object-fit: cover; border-radius: 7px; }
.history-icon { display: grid; place-items: center; width: 46px; height: 37px; border-radius: 7px; color: var(--green); background: var(--green-light); }
.history-title strong { display: block; }
.history-title small { color: var(--muted); }
.history-actions { display: flex; justify-content: end; gap: 5px; }
.table-note { color: var(--muted); padding: 16px 9px; font-size: 13px; }
.search-form { display: grid; grid-template-columns: 1fr auto; align-items: stretch; gap: 9px; margin-bottom: 10px; }
.catalog-source { color: var(--green); font-size: 11px; display: inline-block; }
.catalog-source:hover { text-decoration: underline; }
.benchmark-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 15px; }
.metric-card { padding: 15px; }
.metric-card span, .metric-card small { color: var(--muted); display: block; font-size: 11.5px; }
.metric-card strong { display: block; font-size: 29px; font-weight: 750; letter-spacing: -.048em; margin: 2px 0; }
.benchmark-note { margin-top: 14px; padding: 14px 17px; color: var(--muted); font-size: 12px; }
.benchmark-note p + p { margin-top: 6px; }
.benchmark-note .text-link { margin-top: 8px; }
.benchmark-tables h2 { font-size: 17px; margin: 0 0 8px; }
.benchmark-tables .num strong { color: var(--green-strong); }
.benchmark-examples { margin-top: 20px; }

dialog { width: min(675px, calc(100% - 24px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--line); border-radius: 18px; color: var(--ink); box-shadow: 0 22px 90px #172a2375; }
dialog::backdrop { background: #11241e83; }
#edit-form, #weigh-form { padding: 19px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.dialog-heading h2 { font-size: 23px; letter-spacing: -.033em; }
.dialog-heading p { color: var(--muted); font-size: 12px; }
.edit-total { font-size: 12px; color: var(--green-strong); background: var(--green-light); border-radius: 9px; margin: 10px 0; padding: 7px 9px; }
.edit-rows { display: grid; gap: 8px; margin: 0 0 8px; }
.edit-row { display: grid; grid-template-columns: minmax(0, 1fr) 82px 34px; gap: 7px; align-items: start; }
.edit-row input { min-width: 0; width: 100%; min-height: 35px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 8px; background: var(--page); color: var(--ink); }
.edit-row .icon-button { width: 34px; height: 35px; }
.edit-row .chosen { display: block; color: var(--muted); font-size: 10.5px; margin: 3px 1px; overflow-wrap: anywhere; }
.step-delta { display: block; color: var(--green-strong); font-size: 10px; font-weight: 620; padding: 3px 0; }
.food-choices { display: grid; gap: 2px; margin: 4px 0; max-height: 168px; overflow: auto; }
.food-choices button { text-align: left; background: #f0f5ee; color: var(--ink); border: 0; border-radius: 5px; padding: 6px; font-size: 11px; }
.food-choices button:hover { background: #dfeedd; }
.dialog-footer { display: flex; justify-content: end; gap: 8px; margin-top: 12px; }
#edit-error, #weigh-error { margin-top: 7px; }
.api-page { max-width: 820px; margin: 0 auto; padding: 23px 15px; }
.api-page .page-heading { margin-top: 12px; }
.api-page .card + .card { margin-top: 12px; }
.api-page h2 { font-size: 17px; margin-bottom: 8px; }
.api-page dl { display: grid; gap: 4px; }
.api-page dt { font-weight: 700; }
.api-page dd { margin: 0 0 4px; color: var(--muted); }
.api-page pre { padding: 10px; background: var(--green-light); border-radius: 8px; overflow: auto; }

@media (max-width: 1120px) {
  .sidebar { width: 196px; padding-inline: 12px; }
  .workspace { margin-left: 196px; }
  .content, .topbar { padding-inline: 22px; }
  .card-heading { padding-inline: 13px; }
  .analysis-form { padding-inline: 13px; gap: 8px; }
  .photo-stage { margin-inline: 13px; }
  .result-body { padding-inline: 13px; }
  .summary-card { gap: 9px; }
}
@media (max-width: 920px) {
  .sidebar { width: 169px; padding-inline: 9px; }
  .workspace { margin-left: 169px; }
  .navigation a { gap: 8px; padding-inline: 9px; font-size: 12px; }
  .analysis-grid { gap: 10px; }
  .analysis-form { grid-template-columns: 1fr; }
  .analysis-form .button { width: 100%; }
  .benchmark-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 740px) {
  .sidebar { position: relative; inset: auto; width: 100%; padding: 12px 12px 8px; }
  .brand { padding: 0 4px; }
  .brand-mark { width: 36px; height: 36px; border-radius: 10px; }
  .brand strong { font-size: 19px; }
  .navigation { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; margin-top: 10px; }
  .navigation a { min-height: 31px; gap: 6px; padding: 5px 8px; }
  .navigation .icon { width: 15px; height: 15px; }
  .sidebar-footer { display: none; }
  .workspace { margin: 0; }
  .topbar { min-height: 46px; padding: 6px 12px; }
  .breadcrumb { font-size: 11px; gap: 5px; }
  .network { font-size: 10px; gap: 6px; padding: 4px 8px; }
  .content { padding: 15px 12px 0; }
  .page-heading { gap: 7px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 14px; }
  .page-heading h1 { font-size: 32px; }
  .page-heading p { font-size: 13px; }
  .heading-actions { justify-content: start; }
  .page-heading .button { min-height: 36px; padding: 6px 9px; font-size: 11px; }
  .analysis-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .analysis-form { grid-template-columns: minmax(0, 1fr) auto; }
  .photo-stage { height: clamp(220px, 66vw, 340px); }
  .results-card { min-height: 270px; }
  .truth-content { grid-template-columns: 1fr; gap: 12px; }
  .truth-content .truth-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .examples-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .example img { height: clamp(90px, 28vw, 150px); }
  .section-heading { align-items: start; }
  .section-heading h2 { font-size: 19px; }
  .section-heading p { font-size: 11px; }
  .section-heading .text-link { font-size: 11px; flex: 0 0 auto; }
}
@media (max-width: 370px) {
  .crumb-root, .breadcrumb > [data-icon] { display: none; }
  .analysis-form { grid-template-columns: 1fr; }
  .truth-content .truth-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
