/* Выставки · Procraft. Телефон в первую очередь, планшет и ПК — шире сетка и две колонки в карточке.
   Цвета: фирменный жёлтый #FFBF3C (oklch 0.842 0.156 80.8) с чёрным текстом — только главное действие
   и выбранное состояние. Контраст всех пар текст/фон проверен (WCAG AA) в обеих темах 07.10.2026. */

:root {
  color-scheme: light dark;
  /* примитивы */
  --yellow-500: oklch(0.842 0.156 80.8);
  --yellow-600: oklch(0.783 0.159 77.3);
  --yellow-50: oklch(0.963 0.044 88.5);
  --black: oklch(0 0 0);

  /* роли — светлая тема */
  --bg: oklch(0.975 0.004 85);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.955 0.004 85);
  --surface-3: oklch(0.92 0.005 85);
  --border: oklch(0.9 0.004 85);
  --border-strong: oklch(0.6 0.005 85);
  --text: oklch(0.21 0.005 85);
  --text-2: oklch(0.46 0.006 85);
  --accent-solid: var(--yellow-500);
  --accent-solid-hover: var(--yellow-600);
  --on-accent: var(--black);
  --accent-soft: var(--yellow-50);
  --accent-line: var(--yellow-600);
  --danger: oklch(0.52 0.19 27);
  --danger-solid: oklch(0.52 0.19 27);   /* заливка с белым текстом: 5,6:1 в обеих темах */
  --danger-soft: oklch(0.96 0.018 27);
  --success: oklch(0.52 0.13 150);
  --success-soft: oklch(0.96 0.03 150);
  --info: oklch(0.5 0.14 255);
  --info-soft: oklch(0.955 0.02 255);
  --focus: var(--text);
  --img-outline: oklch(0 0 0 / 0.1);
  --shadow-card: 0 1px 2px oklch(0 0 0 / 0.06), 0 2px 10px oklch(0 0 0 / 0.05);
  --shadow-float: 0 4px 12px oklch(0 0 0 / 0.14), 0 1px 3px oklch(0 0 0 / 0.12);
  --scrim: oklch(0 0 0 / 0.45);

  /* шрифт: системный, с китайскими начертаниями — внешние шрифты в Китае не грузятся */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", sans-serif;
  --fs-caption: 0.8125rem;   /* 13 */
  --fs-small: 0.875rem;      /* 14 */
  --fs-body: 1rem;           /* 16 */
  --fs-title: 1.125rem;      /* 18 */
  --fs-h1: 1.375rem;         /* 22 */

  --r-sm: 10px;
  --r-md: 12px;
  --r-card: 14px;
  --r-section: 16px;
  --gap: 16px;
  --pad: 16px;
  --topbar-h: 56px;
  --tabbar-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: oklch(0.17 0.004 85);
    --surface: oklch(0.215 0.004 85);
    --surface-2: oklch(0.26 0.005 85);
    --surface-3: oklch(0.3 0.006 85);
    --border: oklch(0.3 0.005 85);
    --border-strong: oklch(0.58 0.006 85);
    --text: oklch(0.95 0.003 85);
    --text-2: oklch(0.75 0.005 85);
    --accent-soft: oklch(0.314 0.046 88.2);
    --accent-line: oklch(0.639 0.13 80.9);
    --danger: oklch(0.72 0.16 25);
    --danger-soft: oklch(0.3 0.06 27);
    --success: oklch(0.76 0.15 150);
    --success-soft: oklch(0.3 0.05 150);
    --info: oklch(0.76 0.11 255);
    --info-soft: oklch(0.3 0.04 255);
    --img-outline: oklch(1 0 0 / 0.1);
    --shadow-card: none;
    --shadow-float: 0 4px 16px oklch(0 0 0 / 0.5);
    --scrim: oklch(0 0 0 / 0.6);
  }
}

@media (min-width: 720px) {
  :root { --pad: 24px; --gap: 20px; --tabbar-h: 0px; --topbar-h: 60px; }
}

/* ── основа ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-h) + 8px);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: var(--fs-h1); line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; text-wrap: balance; }
h2 { font-size: var(--fs-title); line-height: 1.3; font-weight: 650; }
h3 { font-size: var(--fs-body); line-height: 1.35; font-weight: 600; }
a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: from-font; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 18px; height: 18px; }
.vh { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.small { font-size: var(--fs-small); line-height: 1.45; }
.caption { font-size: var(--fs-caption); line-height: 1.4; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.skip {
  position: absolute; left: 8px; top: -100px; z-index: 100; padding: 10px 14px; border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-float);
}
.skip:focus { top: 8px; }
main:focus { outline: none; }

/* ── верхняя панель и разделы ───────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in oklab, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}
.topbar-in {
  max-width: 1320px; margin: 0 auto; min-height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding-inline: max(var(--pad), env(safe-area-inset-left)) max(var(--pad), env(safe-area-inset-right));
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-size: var(--fs-title); min-height: 44px; }
.brand-mark { width: 30px; height: 30px; }
.brand-mark rect { fill: var(--accent-solid); }
.brand-mark path { fill: var(--on-accent); }

.tabs { display: flex; gap: 4px; margin-inline-start: auto; }
.tabs a {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; border-radius: var(--r-md);
  text-decoration: none; font-weight: 600; font-size: var(--fs-small); color: var(--text-2);
}
.tabs a[aria-current="page"] { color: var(--text); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
@media (hover: hover) { .tabs a:hover { color: var(--text); background: var(--surface-2); } }

/* телефон: разделы — снизу, под большим пальцем */
@media (max-width: 719.98px) {
  /* backdrop-filter у шапки сделал бы её «рамкой» для position: fixed — нижняя панель уехала бы наверх */
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--surface); }
  .tabs {
    position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; margin: 0; gap: 0;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding: 4px max(8px, env(safe-area-inset-left)) env(safe-area-inset-bottom) max(8px, env(safe-area-inset-right));
    background: color-mix(in oklab, var(--surface) 94%, transparent);
    backdrop-filter: saturate(1.4) blur(12px);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
    border-top: 1px solid var(--border);
  }
  .tabs a { flex: 1; flex-direction: column; justify-content: center; gap: 2px; padding: 4px; font-size: var(--fs-caption); border-radius: var(--r-md); }
  .tabs a[aria-current="page"] { background: transparent; box-shadow: none; }
  .tabs a[aria-current="page"] .i { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); border-radius: 999px; width: 52px; height: 30px; padding: 4px 15px; }
  body.view-form .tabs { display: none; }
  .brand { margin-inline-end: auto; }
}

.outbox-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid transparent; background: var(--info-soft); color: var(--info); font-weight: 600; font-size: var(--fs-small);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.outbox-chip.err { background: var(--danger-soft); color: var(--danger); }

/* ── страница ──────────────────────────────────────────────────────────── */
.page {
  max-width: 1320px; margin: 0 auto;
  padding: 16px max(var(--pad), env(safe-area-inset-right)) calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 96px) max(var(--pad), env(safe-area-inset-left));
}
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head > h1 { margin-inline-end: auto; }

/* ── кнопки ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 16px; border-radius: var(--r-md);
  border: 1px solid transparent; background: var(--surface-2); color: var(--text);
  font-weight: 600; font-size: var(--fs-body); line-height: 1.25; text-decoration: none; text-align: center;
  transition-property: background-color, scale; transition-duration: 150ms; transition-timing-function: ease-out;
}
.btn-primary { background: var(--accent-solid); color: var(--on-accent); }
.btn-outline { background: transparent; border-color: var(--border-strong); }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; color: var(--danger); border-color: currentColor; }
.btn-danger-solid { background: var(--danger-solid); color: oklch(1 0 0); }
.btn-wide { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: default; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: var(--r-md);
  border: 1px solid transparent; background: transparent; color: var(--text);
  transition-property: background-color, scale; transition-duration: 150ms; transition-timing-function: ease-out;
}
.icon-btn.filled { background: var(--surface-2); }
@media (hover: hover) {
  .btn:not(:disabled):hover, .icon-btn:not(:disabled):hover { background: var(--surface-3); }
  .btn-primary:not(:disabled):hover { background: var(--accent-solid-hover); }
  .btn-ghost:not(:disabled):hover, .btn-danger:not(:disabled):hover, .btn-outline:not(:disabled):hover { background: var(--surface-2); }
  .btn-danger-solid:not(:disabled):hover { background: var(--danger-solid); filter: brightness(0.92); }
}
@media (prefers-reduced-motion: no-preference) {
  .btn:not(:disabled):active, .icon-btn:not(:disabled):active, .chip:not(:disabled):active { scale: 0.96; }
}

/* Главное действие списка. На телефоне — плавающая кнопка под большим пальцем, на планшете — в шапке. */
@media (max-width: 719.98px) {
  .fab {
    position: fixed; z-index: 25;
    right: max(16px, env(safe-area-inset-right));
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
    min-height: 56px; padding: 12px 20px 12px 16px; border-radius: 18px; box-shadow: var(--shadow-float);
  }
}

/* ── поиск и фильтры ───────────────────────────────────────────────────── */
.search {
  position: relative; display: flex; align-items: center;
}
.search .i { position: absolute; inset-inline-start: 12px; color: var(--text-2); pointer-events: none; }
.search input {
  width: 100%; min-height: 48px; padding: 10px 44px 10px 44px; border-radius: var(--r-md);
  border: 1px solid var(--border-strong); background: var(--surface); font-size: 1rem;
}
.search .clear { position: absolute; inset-inline-end: 2px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 0 4px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none; max-width: 100%; min-height: 40px; padding: 8px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: var(--fs-small); font-weight: 600;
  white-space: nowrap; transition-property: background-color, scale; transition-duration: 150ms; transition-timing-function: ease-out;
}
.chip[aria-pressed="true"], .chip.on { background: var(--accent-soft); border-color: var(--accent-line); }
.chip .count { color: var(--text-2); font-weight: 500; font-variant-numeric: tabular-nums; }
.chip .tick { display: none; }
.chip[aria-pressed="true"] .tick, .chip.on .tick { display: inline; }
@media (hover: hover) { .chip:not(:disabled):hover { background: var(--surface-2); } .chip[aria-pressed="true"]:hover { background: var(--accent-soft); } }
.result-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0; min-height: 44px; }
.title-block { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; margin-inline-end: auto; }
/* Выставка под заголовком и порядок справа от количества: текст с шевроном, без фона — выровнены по краю колонки */
.fair-btn, .sort-btn {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 44px; padding: 6px 0;
  border: 0; background: transparent; color: var(--text); font-weight: 600; font-size: var(--fs-small);
}
.fair-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fair-btn .i:last-child, .sort-btn .i { color: var(--text-2); }
@media (hover: hover) { .fair-btn:hover span, .sort-btn:hover { text-decoration: underline; text-underline-offset: 0.2em; } }

/* ── сетка карточек фабрик: визитка — главная картинка ─────────────────── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 12px; }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; } }
.day { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 8px; margin-top: 16px; font-size: var(--fs-small); font-weight: 650; }
.day:first-child { margin-top: 4px; }
.day .muted { font-weight: 500; font-variant-numeric: tabular-nums; }
.card {
  position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  background: var(--surface); border: 1px solid transparent; border-radius: var(--r-card); box-shadow: var(--shadow-card);
  color: inherit; text-decoration: none;
}
@media (prefers-color-scheme: dark) { .card { border-color: var(--border); } }
/* Визитка видна целиком (contain): по ней узнают фабрику, обрезать логотип или телефон нельзя.
   Вертикальная визитка встаёт по центру на сером поле. */
.card-img { position: relative; aspect-ratio: 8 / 5; overflow: hidden; background: var(--surface-2); }
.card-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.card-img::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-card) var(--r-card) 0 0; box-shadow: inset 0 0 0 1px var(--img-outline); pointer-events: none; }
.card-ph { display: grid; place-items: center; height: 100%; color: var(--text-2); }
.card-ph .i { width: 34px; height: 34px; stroke-width: 1.5; }
.card-body { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; min-width: 0; }
.card-name {
  font-weight: 650; font-size: 0.9375rem; line-height: 1.3; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.card-cn, .card-meta, .card-groups { font-size: var(--fs-caption); line-height: 1.4; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { font-variant-numeric: tabular-nums; display: flex; gap: 6px; align-items: center; }
.card-flags { position: absolute; top: 8px; inset-inline-end: 8px; display: flex; gap: 6px; }
.flag {
  display: inline-flex; align-items: center; gap: 4px; min-height: 26px; padding: 3px 8px; border-radius: 999px;
  background: var(--surface); color: var(--text); font-size: var(--fs-caption); font-weight: 600; box-shadow: 0 1px 3px oklch(0 0 0 / 0.18);
}
.flag .i { width: 15px; height: 15px; }
.flag.star .i { fill: var(--accent-solid); stroke: var(--on-accent); stroke-width: 1.5; }
.flag.unsent { background: var(--info-soft); color: var(--info); }
@media (hover: hover) { .card:hover { box-shadow: var(--shadow-float); } }
.card:focus-visible { outline-offset: 3px; }

.grid > .empty { grid-column: 1 / -1; }
.page.is-empty .fab { display: none; }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 48px 16px; }
.empty > .i { width: 48px; height: 48px; stroke-width: 1.4; color: var(--text-2); margin-bottom: 8px; }
.empty p { color: var(--text-2); max-width: 36em; }
.empty .btn { margin-top: 12px; }
.loader { display: flex; justify-content: center; padding: 24px; color: var(--text-2); }
.sentinel { height: 1px; }

/* ── карточка фабрики (форма) ─────────────────────────────────────────── */
.form-head { display: flex; align-items: center; gap: 8px; margin: -4px 0 12px; }
.form-head h1 { flex: 1; min-width: 0; font-size: var(--fs-title); overflow-wrap: anywhere; }
.save-state { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-caption); color: var(--text-2); white-space: nowrap; }
.save-state.off { color: var(--info); }
.form { display: grid; gap: var(--gap); }
.form-col { display: grid; gap: var(--gap); align-content: start; min-width: 0; }
@media (min-width: 900px) {
  .form { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; }
}
.section { background: var(--surface); border: 1px solid transparent; border-radius: var(--r-section); padding: 16px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow-card); min-width: 0; }
@media (prefers-color-scheme: dark) { .section { border: 1px solid var(--border); } }
.section-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.section-head h2 { margin-inline-end: auto; }
.fields { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.fields .wide { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-size: var(--fs-small); font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.from-card { font-size: var(--fs-caption); font-weight: 600; color: var(--info); background: var(--info-soft); border-radius: 999px; padding: 1px 8px; }
.input, .field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 11px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-size: 1rem; line-height: 1.4;
}
.field textarea { min-height: 96px; resize: vertical; }
.field select { appearance: none; padding-inline-end: 40px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }
.input-row { display: flex; gap: 8px; align-items: stretch; }
.input-row input { flex: 1; min-width: 0; }
.input-row .icon-btn { width: 48px; height: 48px; background: var(--surface-2); }
.hint { font-size: var(--fs-caption); color: var(--text-2); }
.chips-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.switch { display: flex; align-items: center; gap: 12px; min-height: 48px; font-weight: 600; cursor: pointer; }
.switch input { width: 24px; height: 24px; accent-color: var(--accent-solid-hover); flex: none; }

/* визитка */
.shoot {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  min-height: 168px; padding: 20px; border-radius: var(--r-section); border: 2px dashed var(--border-strong);
  background: var(--surface-2); color: var(--text); font-weight: 650; font-size: var(--fs-title); width: 100%;
}
.shoot .i { width: 40px; height: 40px; stroke-width: 1.6; }
.shoot .muted { font-weight: 500; font-size: var(--fs-small); }
@media (hover: hover) { .shoot:hover { background: var(--surface-3); } }
.media-row { display: flex; flex-wrap: wrap; gap: 8px; }
.cards-photos { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.thumb {
  position: relative; display: block; padding: 0; border: 0; border-radius: var(--r-md); overflow: hidden; background: var(--surface-2);
  aspect-ratio: 8 / 5; width: 100%;
}
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.photos .thumb img { object-fit: cover; }
.thumb::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px var(--img-outline); pointer-events: none; }
.thumb .badge {
  position: absolute; inset-inline-start: 6px; bottom: 6px; display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px; background: var(--surface); color: var(--info); font-size: var(--fs-caption); font-weight: 600;
}
.photos { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(30%, 104px), 1fr)); }
.photos .thumb { aspect-ratio: 1; }
/* Полоса распознавания: синяя (информация), не жёлтая — жёлтый у нас только у главного действия. */
.ocr-progress { display: grid; gap: 8px; padding: 10px 12px; border-radius: var(--r-md); background: var(--info-soft); color: var(--info); }
.ocr-progress-head { display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-small); font-weight: 600; line-height: 1.4; }
.ocr-progress progress { inline-size: 100%; block-size: 8px; appearance: none; -webkit-appearance: none; border: 0; border-radius: 999px; background: var(--surface); color: var(--info); overflow: hidden; }
.ocr-progress progress::-webkit-progress-bar { background: var(--surface); border-radius: 999px; }
.ocr-progress progress::-webkit-progress-value { background: var(--info); border-radius: 999px; }
.ocr-progress progress::-moz-progress-bar { background: var(--info); border-radius: 999px; }
@media (prefers-reduced-motion: no-preference) { .ocr-progress progress::-webkit-progress-value { transition: inline-size 300ms ease-out; } }
.status {
  display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: var(--r-md);
  font-size: var(--fs-small); line-height: 1.45; background: var(--surface-2);
}
.status .i { width: 20px; height: 20px; margin-top: 1px; }
.status.ok { background: var(--success-soft); color: var(--success); }
.status.info { background: var(--info-soft); color: var(--info); }
.status.err { background: var(--danger-soft); color: var(--danger); }
.status .btn { margin-inline-start: auto; min-height: 36px; padding: 6px 12px; font-size: var(--fs-small); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }

/* аудио */
.rec-bar { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r-md); background: var(--danger-soft); color: var(--danger); }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: currentColor; flex: none; }
@media (prefers-reduced-motion: no-preference) { .rec-dot { animation: blink 1.2s ease-in-out infinite; } }
@keyframes blink { 50% { opacity: 0.25; } }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 700; font-size: var(--fs-title); margin-inline-end: auto; }
.audio-list { display: grid; gap: 8px; }
.audio-item { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 6px; border-radius: var(--r-md); background: var(--surface-2); }
.audio-item .meta { flex: 1; min-width: 0; font-size: var(--fs-small); }
.audio-item .meta b { font-variant-numeric: tabular-nums; }
.audio-item .icon-btn.play { background: var(--accent-solid); color: var(--on-accent); border-radius: 50%; }
.audio-prog { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; margin-top: 4px; }
.audio-prog span { display: block; height: 100%; width: 0; background: var(--text); }

.meta-line { font-size: var(--fs-caption); color: var(--text-2); }

/* каталоги и файлы */
.file-list { display: grid; gap: 8px; }
.file-row { display: flex; align-items: center; gap: 4px; border-radius: var(--r-md); background: var(--surface-2); }
.file-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 10px; border-radius: var(--r-md); color: inherit; text-decoration: none; }
.file-ic { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: var(--r-sm); background: var(--surface); color: var(--text-2); }
.file-text { display: flex; flex-direction: column; min-width: 0; }
.file-text b { font-size: var(--fs-small); font-weight: 600; overflow-wrap: anywhere; }
@media (hover: hover) { .file-main:hover { background: var(--surface-3); } }
.section.drop { box-shadow: inset 0 0 0 2px var(--accent-line), var(--shadow-card); background: var(--accent-soft); }

/* товары и цены в карточке */
.offer-list { display: grid; gap: 8px; }
.offer { display: flex; align-items: stretch; gap: 4px; border-radius: var(--r-md); background: var(--surface-2); }
.offer-main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 10px;
  border: 0; border-radius: var(--r-md); background: transparent; text-align: start;
}
.offer-main img { width: 48px; height: 48px; border-radius: var(--r-sm); object-fit: cover; flex: none; }
.offer-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.offer-type { font-weight: 600; font-size: var(--fs-small); line-height: 1.35; overflow-wrap: anywhere; }
.offer-price { font-weight: 700; }
.offer-meta { font-size: var(--fs-caption); color: var(--text-2); overflow-wrap: anywhere; }
.offer .icon-btn { align-self: center; }
@media (hover: hover) { .offer-main:hover { background: var(--surface-3); } }
/* переключатель валюты и выбор фото — настоящие radio, стилизованы подписью */
.seg { display: flex; gap: 0; }
.seg-in, .pick-photos .seg-in { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.seg-btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 8px 10px;
  border: 1px solid var(--border-strong); background: var(--surface); font-weight: 600; cursor: pointer;
}
.seg-btn:first-of-type { border-start-start-radius: var(--r-sm); border-end-start-radius: var(--r-sm); }
.seg-btn:last-of-type { border-start-end-radius: var(--r-sm); border-end-end-radius: var(--r-sm); }
.seg-btn + .seg-in + .seg-btn { border-inline-start-width: 0; }
.seg-in:checked + .seg-btn { background: var(--accent-soft); border-color: var(--accent-line); box-shadow: inset 0 -3px 0 var(--accent-line); }
.seg-in:focus-visible + .seg-btn, .seg-in:focus-visible + .pick-ph, .seg-in:focus-visible + .pick-none { outline: 2px solid var(--focus); outline-offset: 2px; position: relative; z-index: 1; }
.pick-photos { display: flex; flex-wrap: wrap; gap: 8px; }
.pick-none { display: inline-flex; align-items: center; min-height: 64px; padding: 8px 12px; border-radius: var(--r-sm); border: 1px solid var(--border-strong); cursor: pointer; font-size: var(--fs-small); }
.pick-ph { display: block; width: 64px; height: 64px; border-radius: var(--r-sm); overflow: hidden; border: 2px solid transparent; cursor: pointer; position: relative; }
.pick-ph img { width: 100%; height: 100%; object-fit: cover; }
.seg-in:checked + .pick-ph, .seg-in:checked + .pick-none { border: 3px solid var(--accent-line); background: var(--accent-soft); }

/* строки прайса на проверку */
.pl-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pl-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: var(--r-md); background: var(--surface-2); }
.pl-check { display: grid; place-items: center; width: 44px; height: 44px; flex: none; margin: -6px 0 0 -6px; cursor: pointer; }
.pl-check input { width: 24px; height: 24px; accent-color: var(--accent-solid-hover); }
.pl-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pl-body b { overflow-wrap: anywhere; }
.pl-edit { display: grid; grid-template-columns: minmax(0, 1fr) 7.5rem; gap: 8px; align-items: center; margin-top: 4px; }
.pl-edit input { width: 100%; min-height: 44px; padding: 8px 10px; border-radius: var(--r-sm); border: 1px solid var(--border-strong); background: var(--surface); font-size: 1rem; }
.pl-cur { grid-column: 1 / -1; font-size: var(--fs-caption); color: var(--text-2); font-variant-numeric: tabular-nums; }
.pl-row:has(input[type="checkbox"]:not(:checked)) .pl-body { opacity: 0.55; }

/* раздел «Цены» */
.back-link { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; font-weight: 600; font-size: var(--fs-small); color: var(--text-2); text-decoration: none; }
@media (hover: hover) { .back-link:hover { color: var(--text); text-decoration: underline; } }
.type-list { display: grid; gap: 8px; margin-top: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.type-row {
  display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 12px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid transparent; box-shadow: var(--shadow-card); text-decoration: none; color: inherit;
}
@media (prefers-color-scheme: dark) { .type-row { border-color: var(--border); } }
.type-row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.type-row b { overflow-wrap: anywhere; }
.type-range { font-weight: 700; white-space: nowrap; }
@media (hover: hover) { .type-row:hover { box-shadow: var(--shadow-float); } }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 8px 0 12px; }
.stats > div { display: flex; flex-direction: column; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-card); border: 1px solid transparent; }
.stats b { font-size: var(--fs-title); }
.cmp-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.cmp-main {
  display: flex; gap: 12px; align-items: flex-start; padding: 10px; border-radius: var(--r-md); text-decoration: none; color: inherit;
  background: var(--surface); box-shadow: var(--shadow-card); border: 1px solid transparent;
}
@media (prefers-color-scheme: dark) { .cmp-main, .stats > div { border-color: var(--border); } }
.cmp-img { flex: none; width: 72px; height: 72px; border-radius: var(--r-sm); overflow: hidden; background: var(--surface-2); display: grid; place-items: center; color: var(--text-2); }
.cmp-img img { width: 100%; height: 100%; object-fit: cover; }
.cmp-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cmp-price { font-size: var(--fs-title); font-weight: 700; line-height: 1.3; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cmp-price .muted { font-size: var(--fs-small); font-weight: 500; }
.cmp-factory { font-weight: 600; font-size: var(--fs-small); overflow-wrap: anywhere; }
.tag.best { background: var(--success-soft); color: var(--success); gap: 2px; }
.tag .i { width: 14px; height: 14px; }
@media (hover: hover) { .cmp-main:hover { box-shadow: var(--shadow-float); } }
details.raw summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
details.raw pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: var(--fs-small); margin: 0; color: var(--text-2); }

.actionbar {
  position: sticky; bottom: 0; z-index: 15; margin-top: var(--gap);
  margin-inline: calc(-1 * var(--pad)); padding: 12px var(--pad) calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in oklab, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  display: flex; gap: 12px; align-items: center;
}
.actionbar .btn-primary { flex: 1; max-width: 420px; margin-inline-start: auto; }
body.view-form .page { padding-bottom: 0; }

/* ── план зала ─────────────────────────────────────────────────────────── */
.plan-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.plan-tools .search { flex: 1 1 220px; }
.plan {
  position: relative; overflow: auto; overscroll-behavior: contain; touch-action: pan-x pan-y;
  height: calc(100dvh - var(--topbar-h) - var(--tabbar-h) - env(safe-area-inset-bottom) - 210px); min-height: 300px;
  border-radius: var(--r-section); background: var(--surface-2); border: 1px solid var(--border);
}
.plan.pick { height: min(62dvh, 640px); cursor: crosshair; }
.plan-stage { position: relative; width: 100%; }
.plan-stage img { width: 100%; height: auto; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; pointer-events: none; }
.plan-wrap { position: relative; }
.zoom { position: absolute; z-index: 3; top: 8px; inset-inline-end: 8px; display: flex; flex-direction: column; gap: 6px; }
.zoom .icon-btn { background: var(--surface); box-shadow: var(--shadow-float); }
.pin {
  position: absolute; z-index: 2; translate: -50% -100%;
  display: inline-flex; align-items: center; gap: 4px; max-width: 160px; min-height: 30px; padding: 3px 10px 3px 6px;
  border: 0; border-radius: 999px; background: var(--text); color: var(--bg); font-size: var(--fs-caption); font-weight: 650;
  box-shadow: 0 2px 6px oklch(0 0 0 / 0.35);
}
.pin::after { content: ""; position: absolute; left: 50%; bottom: -5px; translate: -50% 0; border: 6px solid transparent; border-bottom: 0; border-top-color: var(--text); }
.pin::before { content: ""; position: absolute; inset: -8px; }
.pin span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pin .i { width: 16px; height: 16px; }
.pin.dim { opacity: 0.35; }
.pin.hit { background: var(--accent-solid); color: var(--on-accent); }
.pin.hit::after { border-top-color: var(--accent-solid); }
/* кнопка зала на общей схеме: жёлтая, по центру номера зала, без «хвостика» */
.pin.spot { translate: -50% -50%; min-height: 32px; padding: 4px 10px; background: var(--accent-solid); color: var(--on-accent); font-size: var(--fs-small); font-weight: 700; box-shadow: 0 0 0 2px oklch(0 0 0 / 0.55), 0 2px 6px oklch(0 0 0 / 0.35); }
.pin.spot::after { display: none; }
.plan-select { flex: 0 1 220px; }
.hall-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 8px; margin: 4px 0 12px; }
.hall-btn {
  display: flex; flex-direction: column; justify-content: center; gap: 0; min-height: 56px; padding: 8px 12px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--border-strong); color: inherit; text-decoration: none; line-height: 1.3;
}
.hall-btn b { font-size: var(--fs-title); }
.hall-btn span { font-size: var(--fs-caption); color: var(--text-2); }
@media (hover: hover) { .hall-btn:hover { background: var(--accent-soft); border-color: var(--accent-line); } }
.pin.spot { min-height: 26px; padding: 2px 8px; font-size: var(--fs-caption); }
.plan-select select { min-height: 48px; }
.map-links { margin-top: 12px; }
.legend-title { margin: 16px 0 8px; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.legend li { display: flex; gap: 10px; align-items: flex-start; }
.legend .grow { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.legend b { font-size: var(--fs-small); }
.legend-halls { display: flex; flex-wrap: wrap; gap: 4px; }
.swatch { width: 20px; height: 20px; border-radius: 5px; flex: none; margin-top: 1px; box-shadow: inset 0 0 0 1px oklch(0 0 0 / 0.15); }
.hall-tag { background: var(--accent-soft); color: var(--text); text-decoration: none; box-shadow: inset 0 0 0 1px var(--accent-line); min-height: 28px; padding: 3px 10px; font-variant-numeric: tabular-nums; }
@media (hover: hover) { .hall-tag:hover { background: var(--accent-solid); } }
.pin.me { background: var(--danger-solid); color: oklch(1 0 0); }
.pin.me::after { border-top-color: var(--danger-solid); }
.plan-mini { position: relative; border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); }
.plan-mini img { width: 100%; height: auto; }

/* ── диалоги ───────────────────────────────────────────────────────────── */
dialog { color: var(--text); }
dialog::backdrop { background: var(--scrim); }
.sheet {
  width: min(100%, 640px); max-width: 100%; max-height: 92dvh; margin: auto auto 0; padding: 0;
  border: 0; border-radius: 20px 20px 0 0; background: var(--surface); overflow: auto; overscroll-behavior: contain;
  box-shadow: var(--shadow-float);
}
.sheet-in { padding: 20px max(20px, env(safe-area-inset-left)) calc(20px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-right)); display: flex; flex-direction: column; gap: 16px; }
.sheet-in > form { display: contents; }
.sheet-head { display: flex; align-items: center; gap: 8px; }
.sheet-head h2 { margin-inline-end: auto; }
.sheet-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.sheet-actions .btn { flex: 1 1 140px; }
@media (min-width: 720px) {
  .sheet { margin: auto; border-radius: 20px; max-height: 86dvh; }
  .sheet.wide { width: min(100% - 48px, 980px); }
}
@media (prefers-reduced-motion: no-preference) {
  dialog[open] { animation: rise 200ms ease-out; }
  @keyframes rise { from { opacity: 0; translate: 0 12px; } }
}
@media (prefers-reduced-motion: reduce) {
  dialog[open] { animation: fade 150ms ease-out; }
  @keyframes fade { from { opacity: 0; } }
}
.list-opts { display: grid; gap: 4px; }
.opt {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 12px; border-radius: var(--r-md);
  border: 0; background: transparent; text-align: start; width: 100%; font-size: var(--fs-body);
}
.opt[aria-pressed="true"], .opt[aria-checked="true"] { background: var(--accent-soft); font-weight: 600; }
.opt .count { margin-inline-start: auto; color: var(--text-2); font-variant-numeric: tabular-nums; }
.opt .tick { visibility: hidden; }
.opt[aria-pressed="true"] .tick, .opt[aria-checked="true"] .tick { visibility: visible; }
@media (hover: hover) { .opt:hover { background: var(--surface-2); } .opt[aria-pressed="true"]:hover { background: var(--accent-soft); } }

.viewer { width: 100%; height: 100%; max-width: 100%; max-height: 100%; margin: 0; padding: 0; border: 0; background: oklch(0.12 0 0); color: oklch(0.96 0 0); }
.viewer::backdrop { background: oklch(0.12 0 0); }
.viewer-in { position: relative; display: flex; flex-direction: column; height: 100%; }
.viewer-bar { display: flex; align-items: center; gap: 8px; padding: max(8px, env(safe-area-inset-top)) 8px 8px; }
.viewer-bar .icon-btn { color: inherit; }
.spacer { width: 44px; flex: none; }
.viewer-bar .title { flex: 1; text-align: center; font-size: var(--fs-small); font-variant-numeric: tabular-nums; }
.viewer-img { flex: 1; min-height: 0; overflow: auto; display: grid; place-items: center; touch-action: pan-x pan-y pinch-zoom; }
.viewer-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-nav { display: flex; justify-content: space-between; gap: 8px; padding: 8px 8px max(8px, env(safe-area-inset-bottom)); }
.viewer-nav .btn { background: oklch(0.25 0 0); color: inherit; }

/* ── уведомления ───────────────────────────────────────────────────────── */
.toasts {
  position: fixed; z-index: 60; left: 50%; translate: -50% 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 84px);
  display: flex; flex-direction: column; gap: 8px; width: min(100% - 32px, 480px); pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--text); color: var(--bg); box-shadow: var(--shadow-float); font-size: var(--fs-small); line-height: 1.45;
}
.toast .msg { flex: 1; }
.toast .icon-btn { color: inherit; }
.toast .btn { min-height: 36px; padding: 6px 12px; font-size: var(--fs-small); background: transparent; color: inherit; border-color: currentColor; }
.toast.err { background: var(--danger-solid); color: oklch(1 0 0); }
@media (prefers-reduced-motion: no-preference) { .toast { animation: rise 200ms ease-out; } }

/* ── вход ──────────────────────────────────────────────────────────────── */
.login { min-height: calc(100dvh - var(--topbar-h)); display: grid; place-items: center; padding: 24px 16px; }
.login form { width: min(100%, 360px); display: flex; flex-direction: column; gap: 16px; }
.login input { text-align: center; font-size: 1.5rem; letter-spacing: 0.3em; font-variant-numeric: tabular-nums; min-height: 56px; }
.err-text { color: var(--danger); font-size: var(--fs-small); display: flex; gap: 6px; align-items: flex-start; }
.err-text .i { width: 18px; height: 18px; margin-top: 2px; }

/* ── «Ещё» ─────────────────────────────────────────────────────────────── */
.more { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); align-items: start; }
.rows { display: grid; gap: 4px; }
.row {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 4px; border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .grow b { display: block; overflow-wrap: anywhere; }
.tag { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); font-size: var(--fs-caption); font-weight: 600; color: var(--text-2); }
