/* Наши рецепты — эмалированная посуда: белая эмаль, кобальтовая кайма. */

@font-face { font-family: "Onest"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(fonts/onest-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(fonts/onest-latin.woff2) format("woff2");
  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; }
@font-face { font-family: "Unbounded"; font-style: normal; font-weight: 500 800; font-display: swap;
  src: url(fonts/unbounded-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Unbounded"; font-style: normal; font-weight: 500 800; font-display: swap;
  src: url(fonts/unbounded-latin.woff2) format("woff2");
  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 {
  --bg: #F2F4F0;
  --surface: #FFFFFF;
  --surface-2: #E8ECE6;
  --ink: #1A2238;
  --ink-2: #4A5470;
  --ink-3: #7B8499;
  --line: #D6DBD3;
  --cobalt: #2A44C9;
  --cobalt-ink: #FFFFFF;
  --cobalt-soft: #E3E8FB;
  --tomato: #D2412A;
  --tomato-soft: #FBE5E0;
  --dill: #2F7D4F;
  --dill-soft: #DDF0E3;
  --butter: #B7860B;
  --butter-soft: #FDF1C9;
  --paper: #FFFDF6;
  --paper-ink: #232323;
  --paper-ink-2: #6B6A63;
  --shadow: 0 1px 0 rgba(26, 34, 56, .06), 0 8px 24px -12px rgba(26, 34, 56, .18);
  --enamel: #FFFFFF;
  --rim: #2A44C9;

  --f-body: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-display: "Unbounded", "Onest", system-ui, sans-serif;

  --s-12: .75rem; --s-14: .875rem; --s-16: 1rem; --s-18: 1.125rem; --s-20: 1.25rem;
  --s-25: 1.5625rem; --s-31: 1.953rem; --s-39: 2.441rem;

  --r-card: 16px;
  --r-ctl: 12px;
  --nav-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121726; --surface: #1A2033; --surface-2: #232A40;
    --ink: #E7EAF3; --ink-2: #AEB5C8; --ink-3: #7E869C; --line: #2E364D;
    --cobalt: #8EA2FF; --cobalt-ink: #0F1430; --cobalt-soft: #26305A;
    --tomato: #FF7A62; --tomato-soft: #45261F;
    --dill: #6BCB8F; --dill-soft: #1E3A2A;
    --butter: #F5D274; --butter-soft: #3D3520;
    --paper: #F4F1E8; --paper-ink: #1D1D1D; --paper-ink-2: #5E5C55;
    --shadow: 0 1px 0 rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6);
    --enamel: #232A40; --rim: #7F95FF;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121726; --surface: #1A2033; --surface-2: #232A40;
  --ink: #E7EAF3; --ink-2: #AEB5C8; --ink-3: #7E869C; --line: #2E364D;
  --cobalt: #8EA2FF; --cobalt-ink: #0F1430; --cobalt-soft: #26305A;
  --tomato: #FF7A62; --tomato-soft: #45261F;
  --dill: #6BCB8F; --dill-soft: #1E3A2A;
  --butter: #F5D274; --butter-soft: #3D3520;
  --paper: #F4F1E8; --paper-ink: #1D1D1D; --paper-ink-2: #5E5C55;
  --enamel: #232A40; --rim: #7F95FF;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--f-body); font-size: var(--s-16); line-height: 1.5;
  -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 0;
}
img { max-width: 100%; display: block; }
a { color: var(--cobalt); }
button, input, textarea, select { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; flex: none; }
:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Каркас ---------- */
.shell { min-height: 100dvh; }
.view { max-width: 1120px; margin: 0 auto; padding: 16px 16px calc(var(--nav-h) + 32px + env(safe-area-inset-bottom)); outline: none; }

.nav {
  position: fixed; z-index: 20; left: 0; right: 0; bottom: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.nav-brand { display: none; }
.nav-item {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px;
  height: 100%; color: var(--ink-3); text-decoration: none; font-size: var(--s-12); font-weight: 500; padding: 0 0 8px;
}
.nav-item[aria-current="page"] { color: var(--cobalt); }
.nav-add svg { width: 26px; height: 26px; padding: 4px; border-radius: 50%; background: var(--cobalt); color: var(--cobalt-ink); box-sizing: content-box; }
.nav-badge {
  position: absolute; top: 2px; left: calc(50% + 10px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--butter); color: #1A1A1A; font-size: 11px; line-height: 18px; text-align: center;
}

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 232px 1fr; }
  .nav {
    position: sticky; top: 0; height: 100dvh; padding: 24px 16px; display: flex; flex-direction: column;
    align-items: stretch; gap: 4px; border-top: 0; border-right: 1px solid var(--line); background: var(--surface);
  }
  .nav-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); margin: 0 8px 28px; }
  .brand-name { font-family: var(--f-display); font-weight: 700; font-size: var(--s-16); letter-spacing: -.01em; line-height: 1.1; }
  .nav-item { flex-direction: row; justify-content: flex-start; height: auto; gap: 12px; font-size: var(--s-16); padding: 10px 12px; border-radius: var(--r-ctl); }
  .nav-item:hover { background: var(--surface-2); color: var(--ink); }
  .nav-item[aria-current="page"] { background: var(--cobalt-soft); color: var(--cobalt); }
  .nav-add svg { width: 22px; height: 22px; padding: 0; background: none; color: inherit; }
  .nav-badge { position: static; margin-left: auto; }
  .view { padding: 40px 40px 64px; }
}
.brand-mark {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 50% 50%, var(--surface) 0 52%, var(--cobalt) 53% 100%);
  box-shadow: inset 0 0 0 1.5px var(--cobalt);
}

/* ---------- Типографика ---------- */
.h1 { font-family: var(--f-display); font-weight: 700; font-size: var(--s-25); line-height: 1.15; letter-spacing: -.015em; margin: 0; text-wrap: balance; }
.h2 { font-family: var(--f-display); font-weight: 600; font-size: var(--s-18); line-height: 1.25; letter-spacing: -.01em; margin: 0 0 12px; }
.lead { color: var(--ink-2); margin: 8px 0 0; max-width: 62ch; }
.muted { color: var(--ink-3); }
.small { font-size: var(--s-14); }
@media (min-width: 900px) { .h1 { font-size: var(--s-31); } .h2 { font-size: var(--s-20); } }

/* ---------- Элементы управления ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: var(--s-14); cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--cobalt); border-color: var(--cobalt); color: var(--cobalt-ink); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--cobalt); }
.btn-danger { color: var(--tomato); }
.btn-danger-fill { background: var(--tomato); border-color: var(--tomato); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-icon { width: 44px; padding: 0; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

.field { display: grid; gap: 6px; }
.field > span { font-size: var(--s-14); font-weight: 600; color: var(--ink-2); }
.input, .textarea, .select {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: var(--r-ctl);
  border: 1.5px solid var(--line); background: var(--surface); font-size: var(--s-16);
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--cobalt); box-shadow: 0 0 0 3px var(--cobalt-soft); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 6px; margin: 0 -16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
@media (min-width: 900px) { .chips { flex-wrap: wrap; overflow: visible; margin: 0; padding: 2px 0; } }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font-size: var(--s-14); font-weight: 500; cursor: pointer; white-space: nowrap;
}
.chip svg { width: 16px; height: 16px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .count { color: inherit; opacity: .6; font-variant-numeric: tabular-nums; }

/* ---------- Коллекция ---------- */
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 8px 0 16px; }
.page-head .count { color: var(--ink-3); font-size: var(--s-14); font-variant-numeric: tabular-nums; white-space: nowrap; }
.search { position: relative; margin-bottom: 12px; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search .input { padding-left: 44px; }

.list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 14px; margin-top: 18px; }
@media (min-width: 700px) { .list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 20px; } }
@media (min-width: 1200px) { .list { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.card { display: grid; gap: 4px; align-content: start; text-decoration: none; color: inherit; border-radius: 26px; }
.card:focus-visible { outline-offset: 4px; }
.card-title {
  font-weight: 600; font-size: var(--s-16); line-height: 1.3; margin: 8px 4px 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-wrap: pretty;
}
.card .meta { padding: 0 4px; font-size: var(--s-12); gap: 2px 10px; }
.card .meta svg { width: 14px; height: 14px; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--ink-3); font-size: var(--s-14); }
.meta span { display: inline-flex; align-items: center; gap: 4px; }
.meta svg { width: 16px; height: 16px; }

/* Эмалированная тарелка: белый обод, по краю — кобальтовая кайма, фото лежит в чаше. */
.dish {
  position: relative; aspect-ratio: 1; border-radius: 26px; background: var(--enamel); isolation: isolate;
  box-shadow: inset 0 0 0 2px var(--rim), 0 12px 26px -18px rgba(26, 34, 56, .45);
}
.dish img, .dish .plate { position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); border-radius: 20px; }
.dish img { object-fit: cover; z-index: 1; background: var(--surface-2); }
.dish.noimg img { display: none; }
.card .fav, .review-dot {
  position: absolute; top: 14px; z-index: 2; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(255, 255, 255, .94); box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}
.card .fav { right: 14px; color: #D2412A; }
.review-dot { left: 14px; color: #9A7006; }
.card .fav svg, .review-dot svg { width: 16px; height: 16px; }

/* Тарелка-заглушка, когда у рецепта нет фото. */
.plate { display: grid; place-items: center; background: var(--tint, var(--cobalt-soft)); }
.plate[data-tint="butter"] { --tint: var(--butter-soft); }
.plate[data-tint="tomato"] { --tint: var(--tomato-soft); }
.plate[data-tint="dill"] { --tint: var(--dill-soft); }
.plate i {
  width: 62%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--f-display); font-style: normal; font-weight: 700; font-size: clamp(22px, 8vw, 40px); color: #2A44C9;
  background: radial-gradient(circle closest-side, #fff 0 58%, #EEF0EA 59% 62%, #fff 63% 88%, #2A44C9 89% 96%, transparent 97%);
  filter: drop-shadow(0 10px 14px rgba(26, 34, 56, .18));
}
.plate.big i { width: min(46%, 220px); font-size: clamp(40px, 12vw, 72px); }
.flag { display: inline-flex; align-items: center; gap: 4px; color: var(--butter); font-weight: 600; }

.empty {
  text-align: center; padding: 40px 20px 44px; border-radius: 28px; background: var(--surface);
  display: grid; justify-items: center; gap: 16px; margin-top: 16px;
}
.empty .plate { width: 132px; aspect-ratio: 1; background: none; }
.empty .plate i { width: 100%; }
.empty p { margin: 0; color: var(--ink-2); max-width: 36ch; }

/* ---------- Рецепт ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -4px 0 12px; }
.round-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 0; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--surface) 90%, transparent); color: var(--ink); cursor: pointer; text-decoration: none;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 2px 12px rgba(10, 14, 30, .16);
  font-size: 24px; line-height: 1;
}
.round-btn svg { width: 20px; height: 20px; }
.round-btn[aria-pressed="true"] { color: var(--tomato); }
.recipe-top {
  position: absolute; z-index: 6; left: 12px; right: 12px; top: calc(12px + env(safe-area-inset-top));
  display: flex; justify-content: space-between; pointer-events: none;
}
.recipe-top > * { pointer-events: auto; }
.recipe-actions { display: flex; gap: 8px; }
.view { position: relative; }

.recipe-hero { display: grid; margin-bottom: 8px; }
.hero-img {
  position: relative; overflow: hidden; margin: -16px -16px 0; aspect-ratio: 4 / 3.2; background: var(--surface-2);
}
.hero-img img, .hero-img .plate { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-img img { object-fit: cover; z-index: 1; }
.hero-img.noimg img { display: none; }
.recipe-hero.no-img .hero-img { aspect-ratio: 16 / 10; }
/* Лист с текстом наезжает на фото; по его верхнему краю — кайма, как у эмалированной миски. */
.hero-text {
  position: relative; z-index: 2; display: grid; gap: 14px; align-content: start;
  margin: -30px -16px 0; padding: 26px 16px 4px; border-radius: 30px 30px 0 0; background: var(--bg);
}
.hero-text::before {
  content: ""; position: absolute; left: 8px; right: 8px; top: 8px; height: 64px; pointer-events: none;
  border: 2px solid var(--rim); border-bottom: 0; border-radius: 23px 23px 0 0;
  -webkit-mask: linear-gradient(#000 20%, transparent); mask: linear-gradient(#000 20%, transparent);
}
.recipe-title {
  font-family: var(--f-display); font-weight: 700; font-size: clamp(1.6rem, 7vw, 2.44rem); line-height: 1.12;
  letter-spacing: -.02em; margin: 4px 0 0; text-wrap: balance;
}
.hero-text .lead { margin: 0; font-size: var(--s-16); }
.byline { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; font-size: var(--s-14); color: var(--ink-3); }
.source-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; text-decoration: none; color: var(--cobalt); word-break: break-word; }
.source-link svg { width: 16px; height: 16px; }
.facts { display: flex; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.facts > div { flex: 1; min-width: 0; padding: 10px 6px; text-align: center; }
.facts > div + div { border-left: 1px solid var(--line); }
.facts b { display: block; font-family: var(--f-display); font-weight: 600; font-size: var(--s-18); line-height: 1.2; font-variant-numeric: tabular-nums; }
.facts span { display: block; font-size: var(--s-12); color: var(--ink-3); line-height: 1.3; margin-top: 2px; }
.btn-cook { width: 100%; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: var(--s-12); padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.tag.cat { background: var(--cobalt-soft); color: var(--cobalt); font-weight: 600; }

.recipe-tabs {
  position: sticky; top: 0; z-index: 5; display: flex; gap: 6px; margin: 4px -16px 10px; padding: 10px 16px;
  background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.recipe-tabs a {
  flex: 1; text-align: center; padding: 8px 6px; border-radius: 999px; font-weight: 600; font-size: var(--s-14);
  color: var(--ink-2); text-decoration: none; background: var(--surface);
}
.recipe-tabs a[aria-current] { background: var(--ink); color: var(--bg); }

@media (min-width: 900px) {
  .recipe-top { position: static; margin: 0 0 16px; }
  .recipe-top .round-btn { box-shadow: none; border: 1px solid var(--line); background: var(--surface); }
  .recipe-hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 44px; align-items: center; margin-bottom: 24px; }
  .hero-img { margin: 0; aspect-ratio: 1; border-radius: 34px; background: var(--enamel); box-shadow: inset 0 0 0 2.5px var(--rim), 0 20px 40px -26px rgba(26, 34, 56, .5); }
  .hero-img img, .hero-img .plate { inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); border-radius: 27px; }
  .recipe-hero.no-img .hero-img { aspect-ratio: 1; }
  .hero-text { margin: 0; padding: 0; background: none; border-radius: 0; }
  .hero-text::before { display: none; }
  .btn-cook { width: auto; justify-self: start; }
  .recipe-tabs { display: none; }
}

.notice {
  display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 14px 16px; border-radius: 18px;
  background: var(--butter-soft); color: var(--ink); margin: 8px 0 12px;
}
.notice svg { color: var(--butter); margin-top: 1px; }
.notice ul { margin: 6px 0 0; padding-left: 18px; color: var(--ink-2); font-size: var(--s-14); }
.notice b { font-weight: 600; }
.notice.error { background: var(--tomato-soft); }
.notice.error svg { color: var(--tomato); }

.recipe-body { display: grid; gap: 32px; }
@media (min-width: 900px) {
  .recipe-body { grid-template-columns: minmax(300px, 390px) 1fr; gap: 48px; align-items: start; }
  .recipe-side { position: sticky; top: 24px; }
}
.section { display: grid; gap: 4px; scroll-margin-top: 70px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.section-head .h2 { margin: 0; }

.scaler { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.scaler button { width: 38px; height: 38px; border: 0; background: none; cursor: pointer; font-size: 18px; color: var(--ink-2); border-radius: 50%; }
.scaler output { min-width: 78px; text-align: center; font-size: var(--s-14); font-weight: 600; font-variant-numeric: tabular-nums; }

.ing-group { font-family: var(--f-display); font-size: var(--s-14); font-weight: 600; color: var(--cobalt); margin: 16px 0 6px; }
.ing { list-style: none; margin: 0; padding: 4px 0; background: var(--surface); border-radius: 20px; }
.ing li + li { border-top: 1px solid var(--line); }
.ing label { display: grid; grid-template-columns: 24px 1fr auto; gap: 12px; align-items: baseline; padding: 12px 16px; cursor: pointer; }
.ing input { appearance: none; width: 22px; height: 22px; margin: 0; border: 2px solid var(--line); border-radius: 50%; align-self: center; display: grid; place-items: center; cursor: pointer; }
.ing input:checked { background: var(--dill); border-color: var(--dill); }
.ing input:checked::after { content: ""; width: 10px; height: 6px; border: solid #fff; border-width: 0 0 2px 2px; transform: rotate(-45deg) translate(1px, -1px); }
.ing input:checked ~ .ing-name, .ing input:checked ~ .ing-qty { color: var(--ink-3); text-decoration: line-through; }
.ing-name { line-height: 1.35; }
.ing-note { display: block; font-size: var(--s-14); color: var(--ink-3); }
.ing-qty { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.ing-qty.unknown { color: var(--butter); font-weight: 500; font-size: var(--s-14); }

/* Шаги — последовательность: номера в эмалированных кружках, соединённые линией. */
.steps { list-style: none; margin: 0; padding: 0; display: grid; counter-reset: step; }
.steps li { position: relative; display: grid; grid-template-columns: 40px 1fr; gap: 14px; padding-bottom: 24px; }
.steps li::before {
  counter-increment: step; content: counter(step); position: relative; z-index: 1;
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--f-display); font-weight: 700; font-size: var(--s-14);
  background: var(--enamel); color: #2A44C9; box-shadow: inset 0 0 0 2px var(--rim);
}
.steps li:not(:last-child)::after { content: ""; position: absolute; left: 18px; top: 42px; bottom: 4px; width: 2px; border-radius: 1px; background: var(--line); }
.step-text { margin: 7px 0 0; max-width: 64ch; font-size: 1.0625rem; line-height: 1.55; text-wrap: pretty; }
.step-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.step-meta span, .timer-chip { display: inline-flex; align-items: center; gap: 5px; font-size: var(--s-12); font-weight: 700; padding: 5px 11px; border-radius: 999px; background: var(--cobalt-soft); color: var(--cobalt); border: 0; }
.timer-chip { cursor: pointer; font-family: inherit; }
.timer-chip::after { content: "▶"; font-size: 9px; margin-left: 2px; }
.step-meta span.hot, .cook-meta .hot { background: var(--tomato-soft); color: var(--tomato); }
.step-meta svg { width: 14px; height: 14px; }

.tips-sec { margin-top: 8px; }
.tips { margin: 0; padding: 16px 18px 16px 36px; background: var(--butter-soft); border-radius: 20px; display: grid; gap: 8px; }
.tips li { max-width: 64ch; }

details.raw { background: var(--surface); border-radius: 18px; padding: 0 16px; margin-top: 28px; }
details.raw summary { cursor: pointer; padding: 14px 0; font-weight: 600; }
details.raw pre { white-space: pre-wrap; word-break: break-word; font-size: var(--s-14); color: var(--ink-2); max-height: 420px; overflow: auto; margin: 0 0 16px; font-family: var(--f-body); }
.added { margin-top: 16px; }

/* ---------- Таймеры ---------- */
.timer-tray { display: flex; flex-wrap: wrap; gap: 8px; }
.timer-tray.floating {
  position: fixed; z-index: 21; right: 12px; bottom: calc(var(--nav-h) + 44px + env(safe-area-inset-bottom));
  flex-direction: column; align-items: flex-end;
}
@media (min-width: 900px) { .timer-tray.floating { bottom: 52px; } }
body.cooking .timer-tray.floating { display: none; }
.timer-pill {
  display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 999px; padding: 8px 14px; cursor: pointer;
  background: var(--ink); color: var(--bg); font: inherit; font-weight: 700; font-variant-numeric: tabular-nums;
  box-shadow: 0 6px 18px -6px rgba(10, 14, 30, .45);
}
.timer-pill svg { width: 16px; height: 16px; }
.timer-pill.done { background: var(--tomato); color: #fff; animation: pulse 1s ease-in-out infinite; }

/* ---------- Режим «Готовить по шагам» ---------- */
/* Переход между вкладками дольше мгновения — тонкая бегущая полоска сверху, чтобы было видно: нажатие принято. */
body.routing::before {
  content: ""; position: fixed; z-index: 100; top: 0; left: 0; width: 40%; height: 3px; border-radius: 0 2px 2px 0;
  background: var(--cobalt); animation: indet 1.1s ease-in-out infinite;
}
body.cooking { overflow: hidden; }
body.cooking .nav, body.cooking .conn { display: none; }
.cook {
  position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column;
  padding: calc(12px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); overflow: hidden;
}
.cook-head { display: grid; grid-template-columns: 42px 1fr 42px; gap: 12px; align-items: center; }
.cook-head .round-btn { box-shadow: none; background: var(--surface); }
.cook-title { text-align: center; min-width: 0; }
.cook-title b { display: block; font-size: var(--s-14); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cook-title span { font-size: var(--s-12); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.cook-progress { display: flex; gap: 3px; margin: 14px 0 10px; }
.cook-progress i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.cook-progress i.past { background: color-mix(in srgb, var(--cobalt) 45%, var(--line)); }
.cook-progress i.now { background: var(--cobalt); }
.cook-step { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: 20px; width: 100%; max-width: 36em; margin: 0 auto; padding: 8px 2px; overflow-y: auto; }
.cook-step > * { flex: none; }
.cook-num {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--f-display); font-size: 26px; font-weight: 700; color: #2A44C9; background: var(--enamel); box-shadow: inset 0 0 0 3px var(--rim);
}
.cook-step p { margin: 0; font-size: clamp(1.3rem, 5.6vw, 2rem); line-height: 1.42; font-weight: 500; text-wrap: pretty; }
.cook-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.cook-meta .hot { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; padding: 8px 14px; border-radius: 999px; }
.cook-nav { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; padding-top: 12px; }
.cook-nav .btn { min-height: 60px; font-size: 1.0625rem; border-radius: 18px; justify-self: stretch; }
.cook-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 78%; overflow: auto; z-index: 2;
  background: var(--bg); border-radius: 26px 26px 0 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -24px 60px -24px rgba(10, 14, 30, .5);
}
.cook-sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cook-sheet-head .h2 { margin: 0; }
.cook-sheet-head .round-btn { box-shadow: none; background: var(--surface); }

/* ---------- Чек ---------- */
.receipt-wrap { margin-top: 24px; }
.store-switch { display: flex; gap: 6px; margin-bottom: 12px; }
.store-switch .chip[aria-pressed="true"] { background: var(--cobalt); border-color: var(--cobalt); color: var(--cobalt-ink); }
.receipt {
  --zig: 9px;
  position: relative; background: var(--paper); color: var(--paper-ink);
  padding: 22px 18px 24px; font-variant-numeric: tabular-nums;
  filter: drop-shadow(0 6px 14px rgba(26, 34, 56, .14));
  -webkit-mask:
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(var(--zig) * 2) var(--zig) repeat-x,
    conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / calc(var(--zig) * 2) var(--zig) repeat-x,
    linear-gradient(#000 0 0) center / 100% calc(100% - var(--zig) * 2) no-repeat;
  mask:
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(var(--zig) * 2) var(--zig) repeat-x,
    conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / calc(var(--zig) * 2) var(--zig) repeat-x,
    linear-gradient(#000 0 0) center / 100% calc(100% - var(--zig) * 2) no-repeat;
}
.rc-head { text-align: center; padding-bottom: 12px; border-bottom: 1.5px dashed #BDB9AC; margin-bottom: 10px; }
.rc-store { font-family: var(--f-display); font-weight: 700; font-size: var(--s-18); letter-spacing: .02em; }
.rc-addr { font-size: var(--s-12); color: var(--paper-ink-2); margin-top: 2px; }
.rc-line { padding: 8px 0; border-bottom: 1px dotted #CFCBBF; }
.rc-line:last-of-type { border-bottom: 0; }
.rc-for { font-size: var(--s-12); color: var(--paper-ink-2); display: flex; justify-content: space-between; gap: 8px; }
.rc-row { display: flex; align-items: baseline; gap: 6px; margin-top: 2px; }
.rc-row label { display: flex; align-items: baseline; gap: 8px; min-width: 0; cursor: pointer; }
.rc-row input { accent-color: #2A44C9; transform: translateY(2px); flex: none; }
.rc-name { font-size: var(--s-14); line-height: 1.3; }
.rc-name small { color: var(--paper-ink-2); }
.rc-dots { flex: 1 1 24px; min-width: 16px; border-bottom: 1.5px dotted #A9A597; transform: translateY(-4px); }
.rc-price { font-weight: 700; white-space: nowrap; font-size: var(--s-14); }
.rc-old { text-decoration: line-through; color: var(--paper-ink-2); font-weight: 400; margin-right: 4px; font-size: var(--s-12); }
.rc-promo { display: inline-block; background: #F7D046; color: #1D1D1D; font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 4px; margin-left: 6px; }
.rc-miss { font-size: var(--s-14); color: var(--paper-ink-2); font-style: italic; }
.rc-actions { display: flex; gap: 12px; margin-top: 4px; }
.rc-actions button, .rc-actions a { border: 0; background: none; padding: 0; color: #2A44C9; font-size: var(--s-12); font-weight: 600; cursor: pointer; text-decoration: none; }
.rc-alts { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.rc-alts button { width: 100%; text-align: left; display: flex; gap: 8px; justify-content: space-between; border: 1px solid #DDD9CC; background: #FFFFFF; border-radius: 8px; padding: 8px 10px; font-size: var(--s-12); cursor: pointer; color: var(--paper-ink); }
.rc-total { display: flex; justify-content: space-between; align-items: baseline; border-top: 1.5px dashed #BDB9AC; margin-top: 10px; padding-top: 12px; }
.rc-total b { font-family: var(--f-display); font-size: var(--s-20); }
.rc-foot { font-size: var(--s-12); color: var(--paper-ink-2); margin-top: 8px; text-align: center; }
.rc-loading { padding: 18px 0; text-align: center; color: var(--paper-ink-2); font-size: var(--s-14); }
.rc-loading .bar { height: 6px; border-radius: 3px; margin: 10px auto 0; width: 60%; background: linear-gradient(90deg, #E5E1D5 0 40%, #C9C4B4 50%, #E5E1D5 60% 100%); background-size: 300% 100%; animation: sweep 1.2s linear infinite; }
@keyframes sweep { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ---------- Добавление и очередь ---------- */
.add-panel { background: var(--surface); border-radius: 26px; padding: 18px; display: grid; gap: 14px; margin: 8px 0 12px; }
.seg { display: inline-grid; grid-auto-flow: column; background: var(--surface-2); border-radius: 999px; padding: 4px; justify-self: start; }
.seg button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; border-radius: 999px; padding: 8px 16px; font-weight: 600; font-size: var(--s-14); color: var(--ink-2); cursor: pointer; }
.seg button svg { width: 16px; height: 16px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.add-row { display: grid; gap: 10px; }
@media (min-width: 600px) { .add-row { grid-template-columns: 1fr auto; align-items: center; } }
.paste-field { position: relative; display: block; }
.paste-field .input { min-height: 56px; padding-right: 108px; border-radius: 16px; }
.paste-btn {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%); border: 0; cursor: pointer;
  background: var(--cobalt-soft); color: var(--cobalt); font: inherit; font-weight: 700; font-size: var(--s-14);
  border-radius: 11px; padding: 10px 14px;
}
.add-panel .btn-big { justify-self: stretch; }
.sources { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.sources span { font-size: var(--s-12); font-weight: 500; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.add-hint { font-size: var(--s-14); color: var(--ink-2); margin: 0; }
.src-note { display: flex; align-items: center; gap: 6px; margin: 0; font-size: var(--s-14); color: var(--ink-2); }
.src-note svg { width: 16px; height: 16px; color: var(--cobalt); }
.bookmarklet {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; cursor: grab;
  background: var(--cobalt); color: var(--cobalt-ink); font-weight: 700; text-decoration: none; white-space: nowrap;
}
.bookmarklet svg { width: 14px; height: 14px; }
details.limits p { margin: 8px 0 0; }
details.limits { font-size: var(--s-14); color: var(--ink-2); }
details.limits summary { cursor: pointer; color: var(--ink-3); }
details.limits ul { margin: 8px 0 0; padding-left: 18px; }
.form-error { color: var(--tomato); font-size: var(--s-14); margin: 0; }
.form-error a { font-weight: 600; }

.jobs-head { margin-top: 28px; }
.jobs { display: grid; gap: 10px; }
.jobs-empty { margin: 0; }
.job { display: grid; grid-template-columns: 42px 1fr; gap: 12px; background: var(--surface); border-radius: 20px; padding: 14px; }
.job-icon { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); }
.job-icon svg { width: 20px; height: 20px; }
.job.s-done .job-icon { background: var(--dill-soft); color: var(--dill); }
.job.s-needs_review .job-icon { background: var(--butter-soft); color: var(--butter); }
.job.s-error .job-icon { background: var(--tomato-soft); color: var(--tomato); }
.job.s-downloading .job-icon, .job.s-transcribing .job-icon, .job.s-extracting .job-icon { background: var(--cobalt-soft); color: var(--cobalt); }
.job-body { display: grid; gap: 6px; min-width: 0; }
.job-top { display: flex; align-items: flex-start; gap: 10px; justify-content: space-between; }
.job-title { font-weight: 600; line-height: 1.3; word-break: break-word; }
.job-sub { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: var(--s-12); color: var(--ink-3); }
.job-url { color: inherit; text-decoration: none; font-weight: 600; }
.job-detail { font-size: var(--s-14); color: var(--ink-2); }
.job-error { font-size: var(--s-14); color: var(--tomato); }
.job-bar { height: 4px; border-radius: 2px; background: var(--cobalt-soft); overflow: hidden; }
.job-bar i { display: block; width: 38%; height: 100%; border-radius: 2px; background: var(--cobalt); animation: indet 1.5s ease-in-out infinite; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(270%); } }
.job .btn-row { margin-top: 2px; }
.job .btn { min-height: 36px; padding: 0 12px; font-size: var(--s-12); }
.job .btn-icon { width: 36px; padding: 0; }
.status { flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: var(--s-12); font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.s-queued { color: var(--ink-3); }
.status.s-downloading, .status.s-transcribing, .status.s-extracting { background: var(--cobalt-soft); color: var(--cobalt); }
.status.s-downloading::before, .status.s-transcribing::before, .status.s-extracting::before { animation: pulse 1.2s ease-in-out infinite; }
.status.s-done { background: var(--dill-soft); color: var(--dill); }
.status.s-needs_review { background: var(--butter-soft); color: var(--butter); }
.status.s-error { background: var(--tomato-soft); color: var(--tomato); }
@keyframes pulse { 50% { opacity: .25; } }

/* ---------- Магазины ---------- */
.chain-list { display: grid; gap: 8px; }
.chain { display: grid; gap: 4px; padding: 12px 14px; border-radius: 16px; background: var(--surface-2); }
.chain-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chain-head b { margin-right: auto; }
.chain-mark { width: 12px; height: 12px; border-radius: 4px; background: var(--ink-3); }
.chain-mark[data-chain="5ka"] { background: #3E9B3A; }
.chain-mark[data-chain="magnit"] { background: #E1251B; }
.chain-mark[data-chain="lenta"] { background: #0A4B9E; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: var(--s-12); }
.vpn-help { font-size: var(--s-14); background: var(--butter-soft); border-radius: 14px; padding: 10px 14px; }
.vpn-help summary { cursor: pointer; font-weight: 600; }
.vpn-help p { margin: 8px 0 0; }
.vpn-help ol { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 6px; }

/* ---------- Система ---------- */
.sys-grid { display: grid; gap: 12px; margin-top: 16px; }
@media (min-width: 800px) { .sys-grid { grid-template-columns: repeat(2, 1fr); } }
.panel { background: var(--surface); border-radius: var(--r-card); padding: 16px; box-shadow: var(--shadow); display: grid; gap: 10px; align-content: start; }
.panel h3 { margin: 0; font-size: var(--s-16); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: var(--s-14); margin: 0; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; text-align: right; word-break: break-word; }
.ok { color: var(--dill); font-weight: 600; }
.bad { color: var(--tomato); font-weight: 600; }
.meter { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--cobalt); border-radius: 4px; }
.errlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: var(--s-14); }
.errlist li { padding: 10px 12px; background: var(--tomato-soft); border-radius: 10px; }
.errlist time { display: block; font-size: var(--s-12); color: var(--ink-3); }
.panel.wide { grid-column: 1 / -1; }
.addr { font-size: var(--s-20); font-weight: 700; font-family: var(--f-display); color: var(--cobalt); word-break: break-all; }

/* ---------- Редактирование ---------- */
.edit-form { display: grid; gap: 16px; max-width: 760px; }
.edit-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.edit-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rows { display: grid; gap: 8px; }
.ing-row { display: grid; grid-template-columns: 1fr 76px 76px 40px; gap: 6px; align-items: start; }
.ing-row .note { grid-column: 1 / 4; }
.ing-row .input { min-height: 44px; padding: 10px; }
.step-row { display: grid; grid-template-columns: 1fr 40px; gap: 6px; }
.step-row .sub { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; grid-column: 1 / 2; }
.fieldset { border: 1px solid var(--line); border-radius: var(--r-card); padding: 14px; display: grid; gap: 10px; }
.fieldset legend { font-weight: 700; padding: 0 6px; }
.sticky-actions { position: sticky; bottom: calc(var(--nav-h) + 8px + env(safe-area-inset-bottom)); display: flex; gap: 8px; justify-content: flex-end; padding: 10px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(8px); border-radius: var(--r-card); }
@media (min-width: 900px) { .sticky-actions { bottom: 16px; } }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.check input { width: 20px; height: 20px; accent-color: var(--cobalt); }

/* ---------- Диалог, меню, тост ---------- */
.dialog { border: 0; border-radius: 20px; padding: 0; background: var(--surface); color: var(--ink); width: min(92vw, 440px); box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); }
.dialog::backdrop { background: rgba(10, 14, 30, .45); }
.dialog-body { padding: 22px; display: grid; gap: 14px; }
.dialog-body h3 { margin: 0; font-family: var(--f-display); font-size: var(--s-18); }
.dialog-body p { margin: 0; color: var(--ink-2); }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.menu-list { display: grid; gap: 4px; }
.menu-list .btn { justify-content: flex-start; border-color: transparent; }
.menu-list .btn:hover { background: var(--surface-2); }
.store-results { display: grid; gap: 6px; max-height: 50vh; overflow: auto; }
.store-results button { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.store-results small { display: block; color: var(--ink-3); }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-size: var(--s-14); font-weight: 500;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 900px) { .toast { bottom: 24px; } }

/* ---------- Связь с компьютером (режим телефона) ---------- */
/* Строка состояния над меню видна всегда: зелёная точка — компьютер отвечает, жёлтая — нет. */
.conn {
  position: fixed; z-index: 19; left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 30px; padding: 5px 16px;
  border: 0; border-top: 1px solid var(--line); cursor: pointer; font-size: var(--s-12); font-weight: 600; color: var(--ink-2);
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.conn span, .conn small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn small { font-size: inherit; font-weight: 500; color: var(--ink-3); flex-shrink: 1; }
.conn small::before { content: "· "; }
.conn[data-state="offline"] { background: var(--butter-soft); color: var(--ink); }
.conn[data-paused="1"] { background: var(--cobalt-soft); color: var(--ink); }
.conn[data-state="unpaired"], .conn[data-state="auth"] { background: var(--tomato-soft); color: var(--ink); }
body[data-route="pair"] .conn { display: none; }
body.has-conn .view { padding-bottom: calc(var(--nav-h) + 64px + env(safe-area-inset-bottom)); }
body.has-conn .toast { bottom: calc(var(--nav-h) + 46px + env(safe-area-inset-bottom)); }
body.has-conn .sticky-actions { bottom: calc(var(--nav-h) + 38px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) {
  .conn { left: 232px; bottom: 0; }
  body.has-conn .view { padding-bottom: 80px; }
  body.has-conn .toast { bottom: 46px; }
  body.has-conn .sticky-actions { bottom: 46px; }
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); flex: none; }
.dot.big { width: 14px; height: 14px; }
[data-state="lan"] > .dot, [data-state="wan"] > .dot { background: var(--dill); box-shadow: 0 0 0 3px var(--dill-soft); }
[data-state="offline"] > .dot { background: var(--butter); box-shadow: 0 0 0 3px color-mix(in srgb, var(--butter) 25%, transparent); }
[data-state="unpaired"] > .dot, [data-state="auth"] > .dot { background: var(--tomato); }
[data-state="unknown"] > .dot { background: var(--cobalt); animation: pulse 1.2s ease-in-out infinite; }
.nav-item[data-conn] { position: relative; }
.nav-item[data-conn]::after {
  content: ""; position: absolute; top: 6px; left: calc(50% + 8px); width: 9px; height: 9px; border-radius: 50%;
  background: var(--ink-3); box-shadow: 0 0 0 2px var(--surface);
}
.nav-item[data-conn="lan"]::after, .nav-item[data-conn="wan"]::after { background: var(--dill); }
.nav-item[data-conn="offline"]::after { background: var(--butter); }
.nav-item[data-conn="unpaired"]::after { background: var(--tomato); }
@media (min-width: 900px) { .nav-item[data-conn]::after { top: 50%; left: auto; right: 14px; transform: translateY(-50%); } }

.conn-head { display: flex; align-items: center; gap: 14px; }
.conn-head b { display: block; font-family: var(--f-display); font-size: var(--s-18); line-height: 1.2; }
.conn-head small { display: block; color: var(--ink-3); font-size: var(--s-14); margin-top: 3px; }
.diag { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: var(--s-14); }
.diag li { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: center; padding: 9px 12px; border-radius: 10px; background: var(--surface-2); }
.diag li svg { width: 18px; height: 18px; }
.diag li.is-ok svg { color: var(--dill); }
.diag li.is-bad svg { color: var(--butter); }
.diag li.is-idle { background: none; border: 1px dashed var(--line); color: var(--ink-3); }
.diag li.is-idle svg, .diag li.is-idle em { color: var(--ink-3); }
.devlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: var(--s-14); }
.devlist li { padding: 10px 12px; background: var(--surface-2); border-radius: 10px; }
.diag small { color: var(--ink-3); word-break: break-all; }
.diag em { font-style: normal; color: var(--ink-2); text-align: right; }
@media (max-width: 560px) { .diag li { grid-template-columns: auto 1fr; } .diag em { grid-column: 2; text-align: left; } }

/* ---------- Подключение телефона ---------- */
.pair-hero { gap: 12px; }
.btn-big { min-height: 56px; padding: 0 24px; font-size: var(--s-16); justify-self: start; border-radius: 16px; }
.btn-big svg { width: 22px; height: 22px; }
details.panel > summary, details.manual > summary { cursor: pointer; font-weight: 600; }
.code-input { letter-spacing: .12em; text-transform: uppercase; font-weight: 700; }
.steps-list { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.steps-list li::marker { font-weight: 700; color: var(--cobalt); }
.inline-ico { width: 18px; height: 18px; vertical-align: -3px; color: var(--cobalt); }
.pair-wait { justify-items: center; text-align: center; padding: 36px 16px; }
.pair-wait p { margin: 0; color: var(--ink-2); }
.pair-done { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; background: var(--dill-soft); border-radius: var(--r-card); padding: 16px; }
.pair-done > svg { color: var(--dill); width: 28px; height: 28px; }
.pair-done b { display: block; margin-bottom: 2px; }
.pair-qr { width: min(260px, 68vw); height: auto; aspect-ratio: 1; justify-self: center; border-radius: 14px; background: #fff; padding: 8px; }
.code-big { font-family: var(--f-display); letter-spacing: .12em; font-size: var(--s-18); color: var(--cobalt); }
.wait-line { display: flex; align-items: center; gap: 8px; margin: 0; }
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--cobalt-soft); border-top-color: var(--cobalt); animation: spin .9s linear infinite; }
.spinner.small { width: 14px; height: 14px; border-width: 2px; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.scan-box { position: relative; border-radius: 14px; overflow: hidden; background: #000; aspect-ratio: 1; }
.scan-box video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 14%; border: 3px solid rgba(255, 255, 255, .92); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .28); }
.thumb.noimg img, .hero-img.noimg { display: none; }

.skeleton { background: var(--surface-2); border-radius: var(--r-card); height: 104px; }
.loading-line { height: 14px; border-radius: 7px; background: var(--surface-2); margin: 8px 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Каналы, авторы и сортировка ---------- */
.page-head:has(.btn-sm) { justify-content: flex-start; align-items: center; }
.page-head .btn-sm { margin-left: auto; }
.btn-sm { min-height: 36px; padding: 0 12px; gap: 6px; }
.btn-sm svg { width: 16px; height: 16px; }
.list-tools { display: flex; gap: 8px; margin: 0 0 10px; }
.list-tools .tool { position: relative; flex: 1; min-width: 0; }
.list-tools .tool[hidden] { display: none; }
.list-tools .tool > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink-3); pointer-events: none; }
.select-sm { min-height: 40px; padding: 8px 12px; font-size: var(--s-14); border-radius: 999px; }
.tool:has(> svg) .select-sm { padding-left: 34px; }
@media (min-width: 700px) { .list-tools .tool { flex: 0 1 280px; } }
.chips.authors { margin-bottom: 6px; }
.chips.authors .chip[aria-pressed="true"] { background: var(--cobalt); border-color: var(--cobalt); color: var(--cobalt-ink); }
.more-wrap { display: grid; place-items: center; margin-top: 24px; }
.more-wrap .btn[hidden] { display: none; }
.crawl {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px; margin: 0 0 12px; border-radius: var(--r-ctl);
  background: var(--cobalt-soft); color: var(--cobalt); font-size: var(--s-14); font-weight: 600; text-decoration: none;
}
.crawl svg { width: 16px; height: 16px; flex: none; animation: spin 2.4s linear infinite; }
@media (prefers-reduced-motion: reduce) { .crawl svg { animation: none; } }
.saved-dot {
  position: absolute; top: 14px; left: 14px; z-index: 2; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(255, 255, 255, .94); box-shadow: 0 2px 8px rgba(0, 0, 0, .15); color: #2F7D4F;
}
.saved-dot svg { width: 16px; height: 16px; }
.card .missing { margin: 0; padding: 0 4px; font-size: var(--s-12); line-height: 1.35; color: var(--tomato); }
.card .missing.ok { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--dill); }
.card .missing svg { width: 14px; height: 14px; }
.btn-save { width: 100%; border-color: var(--cobalt); color: var(--cobalt); }
.btn-save[aria-pressed="true"] { border-color: var(--dill-soft); background: var(--dill-soft); color: var(--dill); }
.byline a { color: var(--cobalt); font-weight: 600; text-decoration: none; }

/* ---------- Есть дома ---------- */
.pantry-lead { margin: -8px 0 14px; }
.pantry-tabs { margin-bottom: 16px; }
.pantry-tabs .n { font-variant-numeric: tabular-nums; color: var(--cobalt); }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-wrap .chip[aria-pressed="true"] { background: var(--dill); border-color: var(--dill); color: #fff; }
.chip-more { border-style: dashed; color: var(--cobalt); }
.pantry-have { margin-bottom: 14px; }
.pantry-have .btn-sm[hidden] { display: none; }
.pgroup { margin: 18px 0; }
.pgroup-h { margin: 0 0 8px; font-size: var(--s-14); font-weight: 600; color: var(--ink-3); }
.staples { margin: 22px 0; }
.staples summary { cursor: pointer; font-weight: 600; font-size: var(--s-14); color: var(--ink-2); }
.staples p { margin: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: var(--s-14); color: var(--ink-2); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--cobalt); flex: none; }
.pantry-go {
  position: sticky; z-index: 5; bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom));
  width: 100%; box-shadow: var(--shadow);
}
@media (min-width: 900px) { .pantry-go { bottom: 16px; width: auto; } }
.pantry-go[hidden] { display: none; }
.pantry-from { margin: 2px 0 6px; }
.link { border: 0; background: none; padding: 0; color: var(--cobalt); font: inherit; font-weight: 600; cursor: pointer; }
.pgroup-dishes { margin-top: 22px; }
.pgroup-dishes .h2 .count { color: var(--ink-3); font-family: var(--f-body); font-weight: 500; font-size: var(--s-14); }
.pgroup-dishes .list { margin-top: 8px; }

/* ---------- Управление каналами ---------- */
.channels { display: grid; gap: 12px; margin: 16px 0 20px; }
@media (min-width: 900px) { .channels { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.channel .btn-row { margin-top: 4px; }
.channel .btn { min-height: 36px; padding: 0 12px; }
.ch-progress { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.ch-progress i { display: block; height: 100%; border-radius: 4px; background: var(--dill); transition: width .4s; }
.pill { font-size: var(--s-12); font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--butter-soft); color: var(--butter); white-space: nowrap; }
.ch-add { max-width: 560px; }
