/* Оформление панели. Основа — вариант «Акцент» из макета (шрифт Onest, малиновый), но малиновый —
   только на главной кнопке экрана, выбранном пункте меню и выбранном фото. Второстепенные кнопки —
   белые с рамкой («Рамка»), метки и статусы — бледные и спокойные («Ведомость»). Без теней и градиентов. */

@font-face { font-family: "Onest"; font-weight: 400 700; font-display: swap;
  src: url("/static/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-weight: 400 700; font-display: swap;
  src: url("/static/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; }

:root {
  --ground: #f8f7f7; --surface: #ffffff; --raised: #f4f2f3; --active: #fbe9f0;
  --border: #ebe7e8; --rule: #f1eeef; --control: #d6d0d2;
  --text: #16131a; --muted: #5f5a5f; --faint: #6a6469;
  --accent: #b8336a; --accent-soft: #fdf2f7; --accent-ink: #6b1d3e;
  --positive: #247b50; --negative: #c4242a;
  --pill-ok-bg: #dcfae5; --pill-ok-ink: #04250e;
  --pill-bad-bg: #ffedea; --pill-bad-ink: #831c1e;
  --pill-warn-bg: #fffbeb; --pill-warn-ink: #92400e;
  --pill-neutral-bg: #efedee; --pill-neutral-ink: #3d393d;
  --guess-bg: #fff8e1; --guess-edge: #f0d98a;
  --radius-card: 12px; --radius-control: 8px; --radius-chip: 6px;
  --gap: 20px; --pad: 20px; --control-height: 36px; --side-width: 232px;
  --font: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--ground); color: var(--text); font: 14px/20px var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--text); text-underline-offset: 3px; text-decoration-color: var(--control); }
a:hover { text-decoration-color: currentColor; }
h1 { font-size: 24px; line-height: 30px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 20px; }
h2 { font-size: 16px; line-height: 22px; font-weight: 600; margin: 0 0 14px; }
p { margin: 0 0 12px; }
code { font-size: 13px; background: var(--raised); padding: 1px 5px; border-radius: 4px; }
.num, input.num, .grid td, table td { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
small.muted, .small-text { font-size: 12px; }

/* оболочка: боковое меню на белом, работа — на светлом фоне */
.app { display: grid; grid-template-columns: var(--side-width) minmax(0, 1fr); min-height: 100vh; }
.side { display: flex; flex-direction: column; padding: 20px 12px 16px; background: var(--surface); border-right: 1px solid var(--border); position: sticky; top: 0; height: 100vh; }
.mark { display: flex; align-items: center; gap: 10px; padding: 0 8px; font-weight: 600; font-size: 15px; text-decoration: none; }
.mark svg { flex: none; }
.scope { margin: 2px 8px 20px 42px; color: var(--muted); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: var(--radius-control); text-decoration: none; color: var(--muted); white-space: nowrap; }
.nav a svg { flex: none; }
.nav a:hover { color: var(--text); background: var(--raised); }
.nav a[aria-current="page"] { background: var(--active); color: var(--accent-ink); font-weight: 500; }
.nav .count { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--accent-ink); background: var(--accent-soft); border-radius: 999px; padding: 0 7px; line-height: 18px; }
.nav-group { margin: 20px 10px 6px; font-size: 12px; color: var(--muted); }
.side .who { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 8px 10px 0; font-size: 13px; }
.avatar { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 600; text-transform: uppercase; }
.side .who form { margin: 0 0 0 auto; }
.canvas { padding: 28px 32px 56px; min-width: 0; max-width: 1440px; }
.bare { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.bare .mark { justify-content: center; margin-bottom: 20px; }

/* блоки */
.card { background: var(--surface); border-radius: var(--radius-card); padding: var(--pad); margin: 0 0 var(--gap); }
.narrow { width: 100%; max-width: 380px; margin: 0 auto; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack > label, .row > label, label.block { display: flex; flex-direction: column; gap: 6px; font-weight: 500; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.row .grow { flex: 1; min-width: 220px; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.title-row h1 { margin: 0; }

/* поля */
input, select, textarea { font: inherit; font-weight: 400; color: var(--text); background: #fff; border: 1px solid var(--control); border-radius: var(--radius-control); height: var(--control-height); padding: 0 10px; min-width: 0; }
input[type="checkbox"] { height: auto; width: 16px; height: 16px; accent-color: var(--accent); }
input[type="file"] { height: auto; border: 0; padding: 0; background: none; color: var(--muted); font-size: 13px; }
input[type="file"]::file-selector-button { font: inherit; font-weight: 500; height: 30px; padding: 0 12px; margin-right: 10px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); color: var(--text); cursor: pointer; }
input[type="file"]::file-selector-button:hover { border-color: var(--muted); }
input[readonly] { background: var(--raised); color: var(--muted); }
textarea { width: 100%; height: auto; padding: 9px 10px; line-height: 21px; resize: vertical; }
select { appearance: none; padding-right: 30px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%235f5a5f' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 10px center; }
input.num { width: 110px; text-align: right; }
input::placeholder, textarea::placeholder { color: var(--faint); }
.check { flex-direction: row !important; align-items: center; gap: 8px !important; font-weight: 400 !important; }

/* кнопки: главная — малиновая (одна на экран), маленькие и второстепенные — белые с рамкой */
button, .btn { font: inherit; font-weight: 500; height: var(--control-height); padding: 0 16px; border-radius: var(--radius-control); border: 1px solid transparent; background: var(--accent); color: #fff; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
button:hover, .btn:hover { filter: brightness(1.08); }
button.small, .btn.small { height: 30px; padding: 0 10px; font-size: 13px; }
button.small, button.secondary, .btn.secondary { background: var(--surface); color: var(--text); border-color: var(--control); }
button.small:hover, button.secondary:hover, .btn.secondary:hover { filter: none; border-color: var(--muted); }
button.danger { background: var(--surface); color: var(--negative); border-color: var(--control); }
button.danger:hover { filter: none; border-color: var(--negative); }
button.link { background: none; border: 0; color: var(--muted); padding: 0; height: auto; font-weight: 400; }
button.link:hover { color: var(--text); filter: none; }
button:disabled, button:disabled:hover { cursor: not-allowed; background: var(--raised); color: var(--muted); border-color: var(--border); filter: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* таблицы: линии и выравнивание, без «зебры» и заливки шапки */
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius-card); margin-bottom: var(--gap); }
.grid { width: 100%; border-collapse: collapse; background: var(--surface); }
.grid th, .grid td { padding: 10px 12px; text-align: left; vertical-align: middle; border-top: 1px solid var(--rule); }
.grid thead th { border-top: 0; font-weight: 400; color: var(--muted); font-size: 12px; padding-top: 12px; padding-bottom: 8px; white-space: nowrap; }
.grid th.r, .grid td.r { text-align: right; white-space: nowrap; }
.grid tr.muted td { color: var(--muted); }
.card .grid th, .card .grid td { padding-left: 0; }
.card .grid { background: none; }

/* сообщения */
.error { color: var(--pill-bad-ink); background: var(--pill-bad-bg); padding: 10px 12px; border-radius: var(--radius-control); }
.notice { display: block; background: var(--pill-warn-bg); color: var(--pill-warn-ink); border: 1px solid #fde68a; padding: 10px 12px; border-radius: var(--radius-control); text-decoration: none; }
.issue { color: var(--negative); font-size: 13px; }

/* метки статуса — бледные пары, без насыщенных заливок */
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--radius-chip); font-size: 12px; font-weight: 500; white-space: nowrap; flex: none; background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); }
.badge.ok { background: var(--pill-ok-bg); color: var(--pill-ok-ink); }
.badge.warn { background: var(--pill-warn-bg); color: var(--pill-warn-ink); }
.badge.bad { background: var(--pill-bad-bg); color: var(--pill-bad-ink); }
.badge.run { background: var(--accent-soft); color: var(--accent-ink); }

/* вкладки (пресеты): подчёркивание */
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--border); margin-bottom: var(--gap); overflow-x: auto; }
.tabs a { padding: 8px 0 10px; text-decoration: none; color: var(--muted); white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); font-weight: 500; border-bottom-color: var(--accent); }

/* загрузка фото */
.drop { display: flex; flex-direction: column; gap: 8px; border: 1px dashed var(--control); border-radius: var(--radius-control); padding: 18px; cursor: pointer; margin-bottom: 10px; background: var(--raised); color: var(--muted); }
.drop:hover { border-color: var(--accent); }
.drop.small { padding: 12px; }
.drop span[data-count]::after { content: " — " attr(data-count); color: var(--positive); font-weight: 500; }
.zone h2 { margin-bottom: 10px; }

/* список товаров */
.filters { margin-bottom: 16px; }
td.thumb { width: 64px; padding-right: 0; }
td.thumb img { width: 44px; height: 44px; object-fit: contain; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-chip); display: block; }
.grid td a { text-decoration: none; font-weight: 500; }
.grid td a:hover { text-decoration: underline; }
.empty { border: 1px dashed var(--control); border-radius: var(--radius-card); padding: 20px; color: var(--muted); }

/* карточка товара: шапка — сам товар */
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--text); }
.head { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 16px; align-items: center; }
.head.no-thumb { grid-template-columns: minmax(0, 1fr) auto; }
.head > img { width: 56px; height: 56px; object-fit: contain; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-control); }
.head h1 { margin: 0 0 4px; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#status { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; }
#status .notice { padding: 4px 10px; }
.finding { margin: 14px 0 0; font-size: 15px; line-height: 22px; }
.head:not(.no-thumb) + .finding { margin-left: 72px; }
.card-notes { margin-top: 12px; display: grid; gap: 8px; }

/* полоса готовности: что уже готово к публикации и что проверить */
.ready { margin: 20px 0 var(--gap); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--raised); border-radius: var(--radius-card); }
.ready > div { padding: 14px 18px; min-width: 0; }
.ready > div + div { border-left: 1px solid var(--border); }
.ready dt { font-size: 12px; color: var(--muted); }
.ready dd { margin: 4px 0 0; font-size: 15px; font-weight: 500; }
.ready dd .of { color: var(--muted); font-weight: 400; }
.ready .warn dd { color: var(--pill-warn-ink); }
.ready .bad dd { color: var(--negative); }
.ready .off dd { color: var(--muted); font-weight: 400; }
.tick { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--positive); margin-right: 8px; vertical-align: 1px; }
.warn .tick { background: #d99a06; }
.bad .tick { background: var(--negative); }
.off .tick { background: var(--control); }

/* тело карточки: фото — 5 колонок из 12, форма — 7; общий зазор --gap */
.card-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--gap); align-items: start; }
.card-grid > *, .photos > .card, .col-form > .card { min-width: 0; }
.photos { display: grid; gap: var(--gap); position: sticky; top: 16px; }
.photos .card, .col-form .card { margin: 0; }
.col-form { display: grid; gap: var(--gap); margin: 0; }
.card h2 small { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 6px; }
.card h2.split { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

.variants { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.variant { margin: 0; }
.variant .pic { display: block; position: relative; aspect-ratio: 1; background: #fff; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.variant .pic img { width: 100%; height: 100%; object-fit: contain; display: block; }
.variant.selected .pic { border-color: var(--accent); outline: 1px solid var(--accent); outline-offset: -2px; }
.variant.check-red .pic { border-color: var(--negative); }
.variant .chosen { position: absolute; left: 8px; top: 8px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: var(--radius-chip); }
.variant figcaption { display: flex; flex-direction: column; gap: 4px; font-size: 13px; margin-top: 10px; align-items: flex-start; }
.variant figcaption b { font-weight: 500; font-size: 14px; }
.variant figcaption b::first-letter { text-transform: uppercase; }
.variant form { margin: 0; }
.variant .inline { margin-top: 4px; gap: 6px; }
.other { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--rule); display: grid; gap: 8px; }
.other .cap { font-size: 13px; color: var(--muted); }
.other form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin: 0; }
.other select { height: 30px; font-size: 13px; }
.sources { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; margin-top: 12px; }
.sources a { display: block; }
.sources img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-chip); border: 1px solid var(--border); display: block; }
.card > .sources:first-of-type { margin-top: 0; }
details summary { cursor: pointer; margin: 12px 0 0; font-size: 13px; color: var(--muted); }
details summary:hover { color: var(--text); }
.src-text { white-space: pre-wrap; font: 13px/19px var(--font); background: var(--raised); padding: 10px 12px; border-radius: var(--radius-control); margin: 8px 0 0; }

.field-l { display: flex; flex-direction: column; gap: 6px; font-weight: 500; }
.field-l + .field-l, .field-l + .issue, .issue + .field-l { margin-top: 14px; }
.field-l .lbl { display: flex; justify-content: space-between; gap: 8px; }
.field-l input { width: 100%; }
.counter { font-size: 12px; font-weight: 400; color: var(--muted); }
.counter.over { color: var(--negative); font-weight: 500; }

/* характеристики: имя · значение · источник; догадки — бледно-жёлтым */
.specs-h, .spec, .add-spec { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.3fr) 104px; column-gap: 12px; align-items: center; }
.specs-h { font-size: 12px; color: var(--muted); padding-bottom: 8px; }
.specs-h .r, .spec .src { text-align: right; }
.spec { padding: 6px 0; border-top: 1px solid var(--rule); }
.spec .name { font-weight: 400; }
.spec input { width: 100%; height: 32px; }
.spec .src { font-size: 12px; color: var(--muted); white-space: nowrap; }
.spec .conf { color: var(--faint); }
.spec.src-guess, .spec.src-keywords { background: var(--guess-bg); border-top-color: transparent; border-radius: var(--radius-control); padding: 6px 8px; margin: 0 -8px; }
.spec.src-guess + .spec, .spec.src-keywords + .spec { border-top-color: transparent; }
.spec.src-guess input, .spec.src-keywords input { border-color: var(--guess-edge); }
.add-spec { margin-top: 10px; }
.add-spec input { width: 100%; height: 32px; }
.facts { margin: 12px 0 0; font-size: 13px; }

.price-out { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--rule); display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.price-out .calc { font-size: 13px; color: var(--muted); }
.price-out .sum { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.qty-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--rule); }
.save-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.save-row a { font-size: 13px; }
.redo { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.redo form { display: flex; gap: 6px; margin: 0; }
.redo select { height: 30px; font-size: 13px; max-width: 220px; }
.redo .gap { flex: 1; }

/* предпросмотр как на ML */
.ml-preview { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; background: #fff; padding: 24px; border-radius: var(--radius-card); }
.ml-photo img { width: 100%; }
.ml-price { font-size: 32px; line-height: 38px; margin: 8px 0 16px; }
.ml-desc { grid-column: 1 / -1; }
.pre { white-space: pre-wrap; }

/* планшет */
@media (max-width: 1100px) {
  .card-grid { grid-template-columns: 1fr; }
  .photos { position: static; }
  .ready { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ready > div:nth-child(4) { border-left: 0; }
  .ready > div:nth-child(n+4) { border-top: 1px solid var(--border); }
}
/* телефон: меню — полоса сверху, прокручивается вбок */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 8px 16px; border-right: 0; border-bottom: 1px solid var(--border); }
  .mark span, .scope, .nav-group { display: none; }
  .mark { padding: 0 4px 0 0; }
  .nav { flex-direction: row; flex-wrap: wrap; order: 3; width: 100%; gap: 2px; }
  .nav .count { margin-left: 6px; }
  .nav a { height: 34px; padding: 0 10px; }
  .nav a svg { display: none; }
  .side .who { margin: 0 0 0 auto; padding: 0 0 0 8px; }
  .side .who .login { display: none; }
  .canvas { padding: 16px 16px 48px; }
  h1, .head h1 { font-size: 20px; line-height: 26px; }
  .head { grid-template-columns: 48px minmax(0, 1fr); }
  .head.no-thumb { grid-template-columns: 1fr; }
  .head > img { width: 48px; height: 48px; }
  .head-actions { grid-column: 1 / -1; }
  .head:not(.no-thumb) + .finding { margin-left: 0; }
  .ready { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ready > div { padding: 12px 14px; }
  .ready > div:nth-child(n) { border-left: 0; border-top: 1px solid var(--border); }
  .ready > div:nth-child(-n+2) { border-top: 0; }
  .ready > div:nth-child(even) { border-left: 1px solid var(--border); }
  .ready > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .specs-h, .spec, .add-spec { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
  .specs-h .r, .spec .src, .add-spec > :last-child { display: none; }
  .card { padding: 16px; }
  .ml-preview { grid-template-columns: 1fr; padding: 16px; }
  .row > label, .row .grow { flex: 1 1 140px; }
  .redo form { width: 100%; }
  .redo select { flex: 1; max-width: none; }
  .redo .gap { display: none; }
  input.num { width: 100%; }
}

/* пачки */
.intake { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; }
.intake .drop { margin: 0; }
.upload-log { margin-top: 14px; padding: 12px 14px; background: var(--raised); border-radius: var(--radius-control); font-size: 13px; max-height: 260px; overflow-y: auto; }
.upload-log p { margin: 0 0 4px; }
.batch-items .inline input.num { width: 90px; }
.batch-items .inline input:not(.num) { width: 150px; }
@media (max-width: 1100px) { .intake { grid-template-columns: 1fr; } }

.batch-new { display: grid; grid-template-columns: minmax(0, 760px) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.batch-new .card { margin: 0; }
.help h2 { margin-bottom: 8px; }
.help pre { font: 13px/20px var(--font); background: var(--raised); padding: 10px 12px; border-radius: var(--radius-control); margin: 8px 0 12px; white-space: pre; overflow-x: auto; }
.help p { font-size: 13px; color: var(--muted); }
@media (max-width: 1100px) { .batch-new { grid-template-columns: 1fr; } }
