:root {
  --bg: #f4f6f8; --panel: #fff; --text: #1d2733; --muted: #6b7785; --line: #dfe4ea;
  --accent: #009696; --accent-dark: #007a7a; --yes: #1f8a43; --no: #c0392b; --unknown: #7f8c8d;
  /* ниже — переменные для дизайнів (Налаштування → Дизайни); значения здесь = стоковый вид */
  --surface: #fff; --surface2: #f7f9fa; --on-accent: #fff; --neutral: #e5e9ee; --neutral-hover: #d6dce3; --thumb-bg: #f0f3f5;
  --tint: #eef7f7; --tint-strong: #e3f4f4; --line-strong: #c8d0d8; --code-bg: #eef1f4; --sel-bg: rgba(255,255,255,.92);
  --ok-bg: #e7f6ec; --ok-line: #bfe3cb; --err-bg: #fdecea; --err-line: #f3c3bd; --warn-bg: #fff7e0; --warn-line: #f0dca0;
  --log-bg: #14323a; --log-text: #d7ecee; --brand-ink: #14323a;
  --side-bg: #14323a; --side-text: #cfe3e6; --side-strong: #fff; --side-focus: #7fd6cc;
  --side-hover: rgba(255,255,255,.08); --side-hover2: rgba(255,255,255,.12); --side-line: rgba(255,255,255,.15); --side-line2: rgba(255,255,255,.18);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --font-head: var(--font); --font-mono: ui-monospace, Consolas, monospace;
  --radius: 12px; --radius-sm: 8px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* иначе display у кнопок и ссылок перебивает атрибут hidden */
body { margin: 0; display: flex; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font); }
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0 0 12px; } h2 { font-size: 18px; margin: 0 0 10px; }
.muted { color: var(--muted); font-weight: 400; }

.sidebar { width: 220px; flex: none; background: var(--side-bg); color: var(--side-strong); padding: 20px 12px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { font-size: 20px; font-weight: 700; padding: 0 12px 18px; letter-spacing: .5px; }
.brand-row { display: flex; align-items: flex-start; justify-content: space-between; }
.brand-row .brand { padding-bottom: 0; line-height: 36px; }
.brand-row { margin-bottom: 18px; }
.nav-toggle { flex: none; width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--side-text);
  font-size: 20px; line-height: 1; cursor: pointer; padding: 0; }
.nav-toggle:hover { background: var(--side-hover2); color: var(--side-strong); }
.nav-toggle:focus-visible { outline: 2px solid var(--side-focus); outline-offset: 1px; }
.mobilebar, .nav-backdrop { display: none; }
@media (min-width: 801px) {                          /* велике вікно: меню згортається в вузьку смужку з кнопкою */
  html.nav-collapsed .sidebar { width: 52px; padding: 20px 8px; overflow: hidden; }
  html.nav-collapsed .sidebar nav, html.nav-collapsed .sidebar .userbox, html.nav-collapsed .sidebar .brand { display: none; }
  html.nav-collapsed .brand-row { justify-content: center; }
}
.sidebar nav a { display: block; color: var(--side-text); padding: 10px 12px; border-radius: 8px; margin-bottom: 4px; }
.sidebar nav a:hover { background: var(--side-hover); text-decoration: none; }
.sidebar nav a.active { background: var(--accent); color: var(--on-accent); }
main { flex: 1; padding: 24px 32px; min-width: 0; }

.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.search { display: flex; gap: 8px; }
input[type=search], input[type=file] { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
input[type=search] { width: 320px; }
button, .button { background: var(--accent); color: var(--on-accent); border: 0; border-radius: 8px; padding: 9px 16px;
  font: inherit; cursor: pointer; display: inline-block; }
button:hover, .button:hover { background: var(--accent-dark); text-decoration: none; }
button:disabled { opacity: .5; cursor: default; }
button.secondary { background: var(--neutral); color: var(--text); }
.link-danger { background: none; color: var(--no); padding: 0; }
.danger-zone { margin-top: 28px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  color: inherit; display: flex; flex-direction: column; transition: box-shadow .15s; }
.card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.1); text-decoration: none; }
.thumb { height: 170px; background: var(--thumb-bg); display: flex; align-items: center; justify-content: center; }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.info { padding: 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.title { font-weight: 600; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.meta { color: var(--muted); font-size: 13px; }
.row { display: flex; justify-content: space-between; align-items: center; margin-top: auto; gap: 8px; }
.price { font-weight: 700; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 99px; color: var(--on-accent); background: var(--unknown); white-space: nowrap; }
.badge.yes { background: var(--yes); } .badge.no { background: var(--no); }

.pager { display: flex; gap: 16px; align-items: center; justify-content: center; margin: 24px 0; }
.empty { background: var(--panel); border: 1px dashed var(--line); border-radius: 12px; padding: 40px; text-align: center; color: var(--muted); }

.panel, .block { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin: 14px 0; }
.panel label { display: block; margin-bottom: 12px; }
.check { display: flex !important; gap: 8px; align-items: center; }
.buttons { display: flex; gap: 10px; }
.notice { border-radius: 10px; padding: 12px 14px; margin: 14px 0; }
.notice.ok { background: var(--ok-bg); border: 1px solid var(--ok-line); }
.notice.error { background: var(--err-bg); border: 1px solid var(--err-line); }

.progress { height: 12px; background: var(--neutral); border-radius: 99px; overflow: hidden; margin: 10px 0; }
#bar { height: 100%; width: 0; background: var(--accent); transition: width .4s; }

.detail { display: grid; grid-template-columns: minmax(280px, 420px) 1fr; gap: 28px; margin: 12px 0 24px; }
.main-photo { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; height: 380px;
  display: flex; align-items: center; justify-content: center; }
.main-photo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.thumbs img { width: 64px; height: 64px; object-fit: cover; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: var(--surface); }
.price-big { font-size: 28px; font-weight: 700; margin: 10px 0; }
.facts > div { padding: 4px 0; } .facts .muted { display: inline-block; min-width: 130px; }
.description { max-width: 900px; }
table.kv { border-collapse: collapse; width: 100%; max-width: 900px; }
table.kv th, table.kv td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.kv th { width: 35%; color: var(--muted); font-weight: 500; }
details summary { cursor: pointer; font-weight: 600; }

@media (max-width: 800px) {                          /* вузький екран: угорі смужка з кнопкою, меню виїжджає поверх сторінки */
  body { flex-direction: column; }
  .mobilebar { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 30; background: var(--side-bg); color: var(--side-strong); padding: 6px 10px; }
  .mobilebar .brand { padding: 0; font-size: 18px; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; max-width: 85vw; height: 100%; z-index: 50;
    transform: translateX(-105%); transition: transform .2s ease; box-shadow: none; }
  html.nav-open .sidebar { transform: none; box-shadow: 4px 0 24px rgba(0,0,0,.35); }
  html.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; }
  .detail { grid-template-columns: 1fr; } main { padding: 16px; }
  .catalog { flex-direction: column; align-items: stretch; }          /* фільтри над списком, а не збоку */
  .filters { width: auto; position: static; }
  .two-cols { grid-template-columns: minmax(0, 1fr); }
  table.kv th { width: auto; } table.kv td, table.kv th { overflow-wrap: anywhere; }
  table.data { display: block; overflow-x: auto; }                    /* широка таблиця гортається всередині, а не розтягує сторінку */
}

/* импорт / экспорт */
.two-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.two-cols .panel { margin: 0; }
.panel h2 { margin-top: 0; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 12px; }
.fields label { margin: 0; }
input[type=text] { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.notice.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); }
#bar.indeterminate { width: 35%; animation: slide 1.2s ease-in-out infinite alternate; }
#bar.full { width: 100%; }
@keyframes slide { from { margin-left: 0; } to { margin-left: 65%; } }
.summary.muted { margin: 8px 0; }
a.button.download { margin-top: 8px; }
.secondary-link { background: var(--neutral); color: var(--text); }
.secondary-link:hover { background: var(--neutral-hover); text-decoration: none; }

.link-row { display: block; margin: 10px 0; font-weight: 600; }
.copy-line { display: flex; gap: 8px; margin-top: 4px; }
.copy-line .feed-link { flex: 1; font-family: monospace; font-size: 13px; }
#url-form input[type=url] { width: 100%; }

/* ---- каталог: фільтри, плитки / список ---- */
.head-tools { display: flex; gap: 10px; align-items: center; }
.view-switch { display: flex; gap: 0; }
.view-switch button { border-radius: 0; padding: 8px 12px; }
.view-switch button:first-child { border-radius: 8px 0 0 8px; } .view-switch button:last-child { border-radius: 0 8px 8px 0; }
.view-switch button.active { background: var(--accent); color: var(--on-accent); }
.catalog { display: flex; gap: 20px; align-items: flex-start; }
.filters { width: 260px; flex: none; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
.filters form { display: flex; flex-direction: column; gap: 10px; }
.filters input[type=search] { width: 100%; }
.filters label { display: block; font-size: 13px; color: var(--muted); }
.filters select, select { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font: inherit; color: var(--text); }
.filter-title { font-size: 13px; color: var(--muted); margin: 16px 0 6px; }
.chosen { font-size: 13px; margin-bottom: 6px; }
.tree { list-style: none; margin: 0; padding-left: 14px; font-size: 14px; }
.group-filter > .tree { padding-left: 0; }
.tree li { margin: 2px 0; }
.tree a.on { font-weight: 700; color: var(--text); }
.tree summary { cursor: pointer; }
.catalog-main { flex: 1; min-width: 0; }
.items.view-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.items.view-grid .list-head, .items.view-grid .meta.code, .items.view-grid .meta.brand, .items.view-grid .meta.group { display: none; }
.items.view-grid .meta.code { display: block; }
.items.view-list { display: flex; flex-direction: column; gap: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.items.view-list .list-head, .items.view-list .card { display: grid; grid-template-columns: 30px 56px minmax(220px, 3fr) 1fr 1fr 1.5fr 130px 150px; gap: 12px; align-items: center; padding: 6px 12px; }
.items.view-list .list-head { font-size: 12px; color: var(--muted); background: var(--surface2); border-bottom: 1px solid var(--line); }
.items.view-list .card { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; flex-direction: row; }
.items.view-list .card:hover { box-shadow: none; background: var(--tint); }
.items.view-list .thumb { height: 48px; width: 56px; }
.items.view-list .info, .items.view-list .row, .card-link { display: contents; }
.items.view-list .title { -webkit-line-clamp: 2; font-weight: 500; }
.items.view-list .meta { font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.items.view-list .sel { position: static; grid-column: 1; background: none; padding: 0; }
.items.view-list .thumb { grid-column: 2; } .items.view-list .title { grid-column: 3; }
.items.view-list .meta.code { grid-column: 4; } .items.view-list .meta.brand { grid-column: 5; } .items.view-list .meta.group { grid-column: 6; }
.items.view-list .row .pricebox { grid-column: 7; } .items.view-list .row .badge { grid-column: 8; justify-self: start; }
.items.view-list .sel, .items.view-list .title, .items.view-list .meta, .items.view-list .row .pricebox, .items.view-list .row .badge, .items.view-list .thumb { grid-row: 1; }
.items.view-grid .card-link { display: flex; flex-direction: column; flex: 1; color: inherit; }
.items.view-grid .card-link:hover { text-decoration: none; }

/* ---- вибір товарів, меню дій, пошук виробника ---- */
.card { position: relative; }
.sel { position: absolute; top: 8px; left: 8px; z-index: 2; background: var(--sel-bg); border-radius: 6px; padding: 3px 5px; line-height: 0; }
.sel input, .sel-all input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.card.selected { outline: 2px solid var(--accent); }
.bulkbar { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.bulkbar .spacer { flex: 1; } .bulkbar .per { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.bulkbar .per select { width: auto; }
.sel-all { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; line-height: 0; }
.menu { position: relative; }
.menu-list { position: absolute; top: 100%; left: 0; z-index: 20; min-width: 270px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 6px 0; margin-top: 4px; }
.menu-list button { display: block; width: 100%; text-align: left; background: none; color: var(--text); border-radius: 0; padding: 8px 16px; }
.menu-list button:hover:not(:disabled) { background: var(--tint); }
.menu-list button:disabled { opacity: .4; }
.menu-list .danger-item { color: var(--no); border-top: 1px solid var(--line); margin-top: 4px; }
button.danger { background: var(--no); } button.danger:hover { background: #a02e22; }
.combo { position: relative; }
.combo input[type=text] { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.combo-list { position: absolute; z-index: 15; left: 0; right: 0; top: 100%; margin: 2px 0 0; padding: 4px 0; list-style: none; max-height: 280px; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.14); }
.combo-list li { padding: 6px 12px; cursor: pointer; font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.combo-list li:hover, .combo-list li.on { background: var(--tint); }
.combo-list li[hidden] { display: none; }
.field { font-size: 13px; color: var(--muted); }
dialog.modal { border: 0; border-radius: 14px; padding: 22px 24px; width: min(520px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog.modal::backdrop { background: rgba(10,25,30,.45); }
dialog.modal label { display: block; margin-bottom: 12px; font-size: 14px; }
.modal-buttons { justify-content: flex-end; margin-top: 16px; }
.picker input[type=search] { width: 100%; margin-bottom: 8px; }
.picker select { width: 100%; }

/* ---- сторінка товару ---- */
.savebar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: flex-end; align-items: center; gap: 12px;
  padding: 8px 0; background: var(--bg); }
.title-input { width: 100%; font: 700 22px/1.3 inherit; padding: 8px 12px; border: 1px solid transparent; border-radius: 8px; background: transparent; margin-bottom: 8px; }
.title-input:hover, .title-input:focus { border-color: var(--line); background: var(--surface); outline: none; }
.detail { display: flex; gap: 24px; flex-wrap: wrap; }
.gallery { width: 360px; max-width: 100%; }
.main-photo { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; height: 320px; display: flex; align-items: center; justify-content: center; }
.main-photo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.thumbs img { width: 56px; height: 56px; object-fit: contain; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.photo-edit { margin-top: 10px; font-size: 14px; } .photo-edit textarea { width: 100%; margin-top: 6px; }
.summary { flex: 1; min-width: 320px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.form-grid label, .two-cols label { display: block; font-size: 13px; color: var(--muted); }
.form-grid .wide { grid-column: 1 / -1; }
input[type=text], input[type=password], input[type=email], input:not([type]), textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; color: var(--text); background: var(--surface); }
textarea { resize: vertical; }
.facts { margin-top: 14px; font-size: 14px; display: grid; gap: 4px; } .facts .muted { display: inline-block; min-width: 90px; }
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.params-table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.params-table th { text-align: left; font-size: 13px; color: var(--muted); padding: 6px 8px; border-bottom: 2px solid var(--line); }
.params-table td { padding: 4px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.params-table .pname { width: 42%; }
.params-table td:nth-child(2) { display: flex; gap: 8px; align-items: center; border-bottom: 0; }
.params-table tr { border-bottom: 1px solid var(--line); }
.params-table .unit { white-space: nowrap; }
.icon-btn { background: none; color: var(--muted); padding: 4px 8px; } .icon-btn:hover { background: var(--err-bg); color: var(--no); }

/* ---- редактор опису ---- */
.rte { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; }
.rte-bar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 6px 8px; background: var(--surface2); border-bottom: 1px solid var(--line); }
.rte-btn { background: var(--surface); color: var(--text); border: 1px solid var(--line); padding: 3px 8px; font-size: 13px; border-radius: 6px; }
.rte-btn:hover { background: var(--tint); }
.rte-btn.b { font-weight: 800; } .rte-btn.i { font-style: italic; } .rte-btn.u { text-decoration: underline; }
.rte-btn.rte-extra { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.rte-select { width: auto; padding: 3px 6px; font-size: 13px; }
.rte-sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.rte-area { min-height: 220px; padding: 14px 18px; outline: none; font-size: 14px; line-height: 1.55; }
.rte-area h1 { font-size: 22px; margin: 0 0 12px; } .rte-area h2 { font-size: 16px; margin: 18px 0 8px; } .rte-area h3 { font-size: 15px; }
.rte-area p { margin: 0 0 10px; } .rte-area ul, .rte-area ol { padding-left: 26px; }
.rte-area table, .description table { border-collapse: collapse; margin: 8px 0; min-width: 50%; }
.rte-area td, .rte-area th { border: 1px dashed var(--line-strong); padding: 4px 10px; text-align: left; }
.rte-source { width: 100%; min-height: 260px; border: 0; border-radius: 0; font: 13px/1.5 Consolas, monospace; }

/* ---- групи, налаштування ---- */
.crumbs { margin: 4px 0 10px; font-size: 14px; }
.gtree-wrap { padding: 10px 14px; }
.gtree { list-style: none; margin: 0; padding-left: 22px; } .gtree-wrap > .gtree { padding-left: 0; }
.grow { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 8px; }
.grow:hover { background: var(--tint); }
.gname { font-weight: 500; }
.gtools { margin-left: auto; display: flex; gap: 10px; align-items: center; opacity: .25; font-size: 13px; }
.grow:hover .gtools { opacity: 1; }
.twist { background: none; color: var(--muted); padding: 0 4px; width: 22px; } .twist:hover { background: none; color: var(--text); }
.twist-gap { width: 22px; display: inline-block; }
.gcount { font-size: 13px; }
.sublist { columns: 2; list-style: none; padding: 0; margin: 0; }
.plist td { padding: 6px 10px; border-bottom: 1px solid var(--line); }
code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }

/* ---- шапка і фото картки ---- */
.topbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; position: sticky; top: 0; z-index: 6; background: var(--bg); padding: 10px 0; border-bottom: 1px solid var(--line); }
.topbar .back { font-size: 22px; padding: 0 6px; }
.topbar-title { font-size: 19px; margin: 0; flex: 1; min-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.menu-link { display: block; padding: 8px 16px; color: var(--text); } .menu-link:hover { background: var(--tint); text-decoration: none; }
.savebar { padding: 4px 0 0; text-align: right; position: static; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-top: 10px; }
.ph { position: relative; aspect-ratio: 1; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; cursor: grab; }
.ph img { width: 100%; height: 100%; object-fit: contain; }
.ph.over { outline: 2px dashed var(--accent); } .ph.broken { background: var(--err-bg); }
.ph-main { position: absolute; top: 3px; left: 3px; background: var(--accent); color: var(--on-accent); font-size: 11px; padding: 1px 6px; border-radius: 99px; }
.ph-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; background: rgba(20,50,58,.78); opacity: 0; transition: opacity .12s; }
.ph:hover .ph-bar { opacity: 1; }
.ph-bar button { background: none; color: var(--on-accent); padding: 2px 5px; font-size: 12px; border-radius: 0; } .ph-bar button:hover:not(:disabled) { background: rgba(255,255,255,.2); } .ph-bar button:disabled { opacity: .3; }
.photo-tools { margin-top: 10px; display: grid; gap: 8px; }
.photo-url { display: flex; gap: 6px; } .photo-url input { flex: 1; }
.small { font-size: 12px; }
.desc-head { display: flex; align-items: center; justify-content: space-between; margin-top: 22px; }
.hint { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 8px; padding: 8px 12px; margin-bottom: 8px; font-size: 14px; }
button.link { background: none; color: var(--accent-dark); padding: 0; text-decoration: underline; }
.rte-area h3 { font-size: 22px; margin: 0 0 12px; line-height: 1.3; }

.filter-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; align-items: end; }
.filter-row label, .filter-row .field { margin: 0; font-size: 13px; color: var(--muted); }
.filter-row input[type=search], .filter-row select { width: 100%; }
.group-pick { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }

/* вхід і користувачі */
.sidebar { display: flex; flex-direction: column; }
.userbox { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--side-line); font-size: 14px; }
.userbox .who { padding: 0 12px 8px; color: var(--side-strong); font-weight: 600; word-break: break-all; }
.userbox .tag { font-size: 11px; background: var(--side-line2); border-radius: 6px; padding: 1px 6px; margin-left: 4px; font-weight: 400; }
.userbox a { display: block; color: var(--side-text); padding: 6px 12px; border-radius: 8px; }
.userbox a.active { background: var(--accent); color: var(--on-accent); }
.userbox form { padding: 8px 12px 0; } .userbox button { width: 100%; }
.auth-page { display: block; }
.auth-box { max-width: 380px; margin: 9vh auto 0; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.auth-box h1 { text-align: center; color: var(--brand-ink); letter-spacing: .5px; margin-bottom: 4px; }
.auth-box .sub { text-align: center; margin: 0 0 18px; }
.auth-box label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.auth-box input { display: block; width: 100%; margin-top: 4px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.auth-box button { width: 100%; padding: 11px; }
table.users { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
table.users th, table.users td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
table.users td.act { text-align: right; white-space: nowrap; }
.plist .chk { width: 34px; text-align: center; } .plist tr.selected { background: var(--tint); }
table.plist { max-width: none; } .plist td { vertical-align: middle; } .plist .row-actions { text-align: right; white-space: nowrap; }
.plist .row-actions a { margin-left: 10px; font-size: 13px; }
.plist .row-actions a.link-danger { color: var(--no); }

/* замовлення й продажі */
.head-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 12px; }
.chip { background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 4px 12px; color: var(--text); font-size: 14px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); } .chip:hover { text-decoration: none; border-color: var(--accent); }
.ofilters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ofilters input[type=search] { width: 280px; } .ofilters select, .bulkbar select, .buttons select { width: auto; }
.ofilters input[type=date] { padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font: inherit; width: auto; }
.ofilters .inl { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 14px; }
table.data { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
table.data th, table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.data th { font-size: 13px; color: var(--muted); font-weight: 500; background: var(--surface2); }
table.data .num, table.data th.num { text-align: right; } table.data td.chk { width: 34px; }
table.data input:not([type=checkbox]) { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
table.data input.num { text-align: right; width: 96px; }
.small { font-size: 12px; } .nowrap { white-space: nowrap; }
.badge.st-new { background: #2f7fd1; } .badge.st-processing { background: #c78a10; } .badge.st-shipped { background: #7a52c7; } .badge.st-packing { background: #d1662f; }
.badge.st-delivered { background: #17958c; } .badge.st-completed { background: var(--yes); } .badge.st-canceled { background: var(--no); } .badge.st-returned { background: #8a5a44; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 8px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; } .stat .big { font-size: 24px; font-weight: 700; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 170px; overflow-x: auto; padding-bottom: 22px; }
.bar { position: relative; flex: 1 0 22px; max-width: 46px; height: 100%; display: flex; align-items: flex-end; }
.bar i { display: block; width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar span { position: absolute; bottom: -20px; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--muted); }
.two-cols-blocks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.empty { text-align: center; padding: 30px; }
.topbar .danger { margin-left: 4px; }
textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
@media (max-width: 800px) { .two-cols-blocks { grid-template-columns: 1fr; } }

.item-photo { display: block; width: 56px; height: 56px; object-fit: contain; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.item-photo.none { display: flex; align-items: center; justify-content: center; font-size: 22px; opacity: .5; }
table.data th.ph, table.data td.ph { width: 70px; padding-right: 0; }

/* ---- вибір моделі ШІ кнопками ---- */
.model-pick { grid-column: 1 / -1; }
.model-pick .lbl { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.mchips { display: flex; flex-wrap: wrap; gap: 8px; }
.mchip { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; max-width: 320px; cursor: pointer; }
.mchip:hover { background: var(--tint); border-color: var(--accent); }
.mchip small { color: var(--muted); font-weight: 400; font-size: 12px; }
.mchip.on { background: var(--tint-strong); border-color: var(--accent); outline: 2px solid var(--accent); }
.mchip.missing b { color: var(--muted); }
.mchip.other { border-style: dashed; }
.model-pick input[type=text] { margin-top: 8px; max-width: 420px; }
.model-pick #ai-model-note { margin-top: 6px; font-size: 13px; }
.ai-mode { width: auto; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font: inherit; font-size: 13px; }
#card-batch .notice { margin: 8px 0; }
#card-batch .notice button { margin-left: 8px; }

/* Інструменти імпорту */
.sidebar nav .subnav { margin: -2px 0 6px 14px; border-left: 1px solid var(--side-line2); padding-left: 6px; }
.sidebar nav .subnav a { padding: 7px 10px; font-size: 14px; margin-bottom: 2px; }
.crumbs { margin: 0 0 4px; color: var(--muted); font-size: 14px; }
.tool-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.tool-card { display: block; color: inherit; margin: 0; }
.tool-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.1); text-decoration: none; }
.tool-go { color: var(--accent); font-weight: 600; }
.tool-inputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-bottom: 8px; }
.tool-input { display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 2px dashed var(--line); border-radius: 10px; margin: 0; }
.tool-input input[type=file] { width: 100%; }
#tool-run { font-size: 16px; padding: 11px 22px; }
#tool-run:disabled { opacity: .6; cursor: wait; }
.btn-link { display: inline-block; background: var(--accent); color: var(--on-accent); padding: 11px 20px; border-radius: 8px; font-weight: 600; margin: 0 8px 8px 0; }
.btn-link:hover { text-decoration: none; filter: brightness(1.08); }
.tool-sec { border-top: 1px solid var(--line); padding: 8px 0; }
.tool-sec ul { max-height: 260px; overflow: auto; margin: 6px 0; }
#tool-history td a { display: block; }
.sidebar nav details.navgroup { margin-bottom: 4px; }
.sidebar nav details.navgroup > summary { font-weight: 400; display: flex; justify-content: space-between; align-items: center; cursor: pointer; list-style: none;
  color: var(--side-text); padding: 10px 12px; border-radius: 8px; user-select: none; }
.sidebar nav details.navgroup > summary::-webkit-details-marker { display: none; }
.sidebar nav details.navgroup > summary::after { content: "▸"; font-size: 12px; transition: transform .15s; }
.sidebar nav details.navgroup[open] > summary::after { transform: rotate(90deg); }
.sidebar nav details.navgroup > summary:hover { background: var(--side-hover); }
.sidebar nav details.navgroup > summary.active { color: var(--side-strong); font-weight: 600; }
.tool-optional { margin: 10px 0 14px; } .tool-optional summary { cursor: pointer; color: var(--muted); }
.tool-optional .tool-input { margin-top: 8px; max-width: 560px; }
.tool-log { background: var(--log-bg); color: var(--log-text); border-radius: 8px; padding: 10px 12px; max-height: 260px; overflow: auto; font-size: 13px; white-space: pre-wrap; }
.tool-optional label.check { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0; }
.tool-feedlog li { font-size: 13px; }

/* закріплені файли в інструментах імпорту */
.tool-input.pinned { border-style: solid; border-color: var(--accent, #0f9d8a); background: rgba(15, 157, 138, .05); }
.pin-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; }
.pin-actions { display: inline-flex; gap: 12px; }
#pin-box { margin: 10px 0 4px; }

/* опт під ціною в списку товарів (лише для товарів, що продаються оптом) */
.pricebox { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pricebox .opt { font-size: 12px; font-weight: 600; color: #6d3fb5; white-space: nowrap; }
.pricebox .opt-from { font-size: 12px; color: #6d3fb5; white-space: nowrap; }
.items.view-list .pricebox .opt { white-space: normal; }
.pin-actions .btn-link { padding: 4px 12px; font-size: 13px; }
.pin-actions .pin-remove { background: var(--neutral); color: var(--text); }
.trio { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 10px 14px; }
@media (max-width: 700px) { .trio { grid-template-columns: 1fr; } }

/* додатковий інструмент під основним на сторінці постачальника (APRO KRATNO) */
.tool-sub { margin-top: 36px; padding-top: 22px; border-top: 2px solid var(--line); }
.tool-sub .sub-title { font-size: 22px; margin: 0 0 8px; }


/* мініатюра першої позиції в списку замовлень */
.orders-table th.thumb-col, .orders-table td.thumb-col { width: 56px; padding-right: 0; }
.order-thumb { display: block; width: 44px; height: 44px; object-fit: contain; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.order-thumb.none { display: flex; align-items: center; justify-content: center; font-size: 18px; opacity: .45; }
.orders-table td.thumb-col a:hover { text-decoration: none; }

.filters-toggle { display: none; }

/* історія оновлень програми */
.history { margin: 10px 0 20px; }
.history details.hv { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 0 16px; margin: 0 0 10px; }
.history details.hv > summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 12px 0; list-style: none; cursor: pointer; }
.history details.hv > summary::-webkit-details-marker { display: none; }
.history details.hv > summary::before { content: "▸"; color: var(--muted, #6b7a80); font-size: 12px; margin-right: -4px; }
.history details.hv[open] > summary::before { content: "▾"; }
.history .hv-ver { font-weight: 700; }
.history .hv-title { flex: 1 1 200px; }
.history .hv-date { color: var(--muted, #6b7a80); font-size: 13px; }
.history .hv-now { background: var(--ok-bg); border: 1px solid var(--ok-line); border-radius: 999px; padding: 1px 9px; font-size: 12px; }
.history details.hv ul { margin: 0 0 12px; padding-left: 22px; }
.history details.hv li { margin: 5px 0; line-height: 1.45; }

/* ================= Телефон (≤700 px): без горизонтальної прокрутки сторінки, таблиці — картками ================= */
/* ---- розкладки меню для дизайнів (Налаштування → Дизайни): grouped — з групами, top — зверху ---- */
.navlabel { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--side-text); opacity: .65; padding: 14px 12px 4px; }
.sidebar nav .ic { display: none; flex: none; width: 22px; text-align: center; }
.navdrop > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--side-text);
  padding: 10px 12px; border-radius: 8px; user-select: none; }
.navdrop > summary::-webkit-details-marker { display: none; }
.navdrop > summary::after { content: "▾"; font-size: 11px; }
.navdrop > summary.active { color: var(--side-strong); font-weight: 600; }
.navdrop .drop { padding: 0 0 4px 14px; }
.navdrop .dh { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--side-text); opacity: .65; padding: 8px 12px 2px; }
.userdrop > summary::after { content: none; }
.userdrop { margin-top: auto; border-top: 1px solid var(--side-line); padding-top: 10px; }
.userdrop .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.userdrop > summary { justify-content: flex-start; color: var(--side-strong); font-weight: 600; }
.userdrop .drop a { display: block; color: var(--side-text); padding: 6px 12px; border-radius: 8px; }
.userdrop .tag { font-size: 11px; background: var(--side-line2); border-radius: 6px; padding: 1px 6px; margin-left: 4px; font-weight: 400; }
@media (min-width: 801px) {
  html[data-layout="top"] body { flex-direction: column; }
  html[data-layout="top"] .sidebar { position: sticky; top: 0; z-index: 40; width: auto; height: auto; min-height: 64px; overflow: visible; display: flex; flex-direction: row;
    align-items: center; gap: 4px 28px; padding: 0 32px; }
  html[data-layout="top"] .brand-row { margin: 0; }
  html[data-layout="top"] .brand-row .brand { padding: 0; }
  html[data-layout="top"] #nav-toggle { display: none; }
  html[data-layout="top"] .sidebar nav.topnav { display: flex; flex-direction: row; align-items: stretch; align-self: stretch; gap: 2px; }
  html[data-layout="top"] .topnav > a, html[data-layout="top"] .topnav > details > summary { display: flex; align-items: center; margin: 0; padding: 0 14px; min-height: 64px; border-radius: 0;
    border-bottom: 2px solid transparent; }
  html[data-layout="top"] .topnav > a.active, html[data-layout="top"] .topnav > details > summary.active { background: none; color: var(--side-strong); border-bottom-color: var(--accent); }
  html[data-layout="top"] .navdrop { position: relative; display: flex; }
  html[data-layout="top"] .navdrop[open] > summary { color: var(--side-strong); }
  html[data-layout="top"] .navdrop .drop { position: absolute; top: calc(100% + 2px); left: 0; z-index: 60; min-width: 240px; padding: 8px; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0,0,0,.18); }
  html[data-layout="top"] .navdrop .drop.right { left: auto; right: 0; min-width: 220px; }
  html[data-layout="top"] .navdrop .drop.wide { display: grid; grid-auto-flow: column; gap: 8px 28px; padding: 16px 20px; min-width: 560px; }
  html[data-layout="top"] .navdrop .dh { color: var(--muted); padding: 4px 10px 6px; }
  html[data-layout="top"] .navdrop .drop a { display: block; margin: 0; padding: 9px 10px; color: var(--text); border-radius: var(--radius-sm); }
  html[data-layout="top"] .navdrop .drop a:hover { background: var(--tint); text-decoration: none; }
  html[data-layout="top"] .navdrop .drop a.active { background: var(--tint-strong); color: var(--accent-dark); font-weight: 600; }
  html[data-layout="top"] .userdrop { margin: 0 0 0 auto; border: 0; padding: 0; }
  html[data-layout="top"] .userdrop > summary { padding: 6px 8px; border-radius: 999px; }
  html[data-layout="top"] .userdrop .drop button { width: 100%; margin-top: 4px; }
  html[data-layout="top"] main { padding-top: 28px; }
}

/* ---- Налаштування → Дизайни ---- */
.dz-pages { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 14px 0; }
.dz-pages button.on { background: var(--accent); color: var(--on-accent); }
.dz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr)); gap: 18px; }
.dz-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.dz-card.chosen { outline: 3px solid var(--accent); outline-offset: -1px; }
.dz-frame { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); background: var(--thumb-bg); pointer-events: none; }
.dz-frame iframe { position: absolute; left: 0; top: 0; width: 1440px; height: 900px; border: 0; transform-origin: 0 0; background: #fff; }
.dz-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.dz-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dz-head h2 { margin: 0; }
.dz-sw { display: inline-flex; } .dz-sw i { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0,0,0,.2); margin-left: -4px; }
.dz-tag { font-weight: 600; }
.dz-actions { margin-top: auto; align-items: center; flex-wrap: wrap; }
.dz-now { color: var(--yes); font-weight: 700; }
.design-banner { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 90; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: center;
  background: #1d2733; color: #fff; padding: 10px 16px; border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.35); width: max-content; max-width: calc(100vw - 24px); font-family: system-ui, sans-serif; font-size: 14px; }
.design-banner button { background: #009696; color: #fff; border-radius: 8px; padding: 8px 14px; font: inherit; font-weight: 600; }
.design-banner .secondary-link { background: #e5e9ee; color: #1d2733; padding: 8px 14px; }
html.design-frame body { overflow: hidden; }

/* ---------- Облік ---------- */
.acc-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.acc-tabs a { padding: 9px 14px; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -1px; font-weight: 500; }
.acc-tabs a:hover { color: var(--text); } .acc-tabs a.active { color: var(--accent-dark); border-bottom-color: var(--accent); }
.acc-month { display: flex; gap: 6px; align-items: center; } .acc-month select { width: auto; min-width: 170px; } .acc-month .button { padding: 8px 14px; }
.acc-kpi .stat .big { white-space: nowrap; } .acc-profit { background: var(--tint); border-color: var(--accent); } .acc-profit.neg { background: var(--err-bg); border-color: var(--err-line); }
.acc-warn { margin: 0 0 14px; } .acc-note { margin: 8px 0 0; font-size: 13px; }
.acc-sum td { padding: 7px 10px; } .acc-sum td.sub { padding-left: 26px; color: var(--muted); } .acc-sum tr.total td { font-weight: 700; border-top: 2px solid var(--line-strong); background: var(--surface2); }
.bar i.neg, .neg { color: var(--no); } .bar i.neg { background: var(--no); }
.acc-empty ol { padding-left: 20px; line-height: 1.8; }
.acc-strip { display: flex; gap: 8px 18px; align-items: center; flex-wrap: wrap; margin: 12px 0; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.acc-strip .grow { flex: 1 1 0; } .acc-strip button { padding: 6px 12px; font-size: 14px; }
table.acc-journal { font-size: 13px; } table.acc-journal th, table.acc-journal td { padding: 6px 6px; } table.acc-journal th { font-size: 12px; } .nowrap { white-space: nowrap; }
table.acc-journal td.acc-name { min-width: 200px; max-width: 280px; } table.acc-journal tr.dim td { opacity: .55; } table.acc-journal tr.noprice td { background: var(--warn-bg); }
table.acc-journal input.f-supplier { width: 104px; } table.acc-journal input.num { width: 72px; } table.acc-journal td input:not([type=checkbox]) { padding: 5px 7px; }
table.acc-journal input.manual { border-color: var(--accent); background: var(--tint); } input.saved { border-color: var(--yes) !important; box-shadow: 0 0 0 2px var(--ok-line); } input.bad { border-color: var(--no) !important; }
table.acc-journal td.acc-act { width: 30px; } .acc-journal .c-profit b { font-size: 14.5px; } .link.danger { color: var(--no); background: none; border: 0; padding: 2px 6px; cursor: pointer; font-size: 15px; }
.acc-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; margin: 10px 0; } .acc-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.acc-form input, .acc-form select { width: 100%; }
.acc-mode { border: 1px solid var(--line); border-radius: 10px; margin: 10px 0; padding: 8px 12px; } .acc-mode label { display: block; padding: 3px 0; }
.acc-preview { overflow: auto; max-height: 300px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; } .acc-preview table.data { font-size: 12.5px; border: 0; width: max-content; min-width: 100%; display: table; }
.acc-preview tr.hdr td { background: var(--tint-strong); font-weight: 600; } .acc-preview td, .acc-preview th { white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.acc-settings { max-width: 760px; } .acc-settings label { display: block; margin: 14px 0; font-weight: 500; } .acc-settings label input { display: block; width: 100%; margin: 6px 0 3px; } .acc-settings label .muted { font-weight: 400; font-size: 13px; }
.acc-upload input[type=file] { max-width: 100%; }
.acc-prices-top section, .two-cols-blocks > section { min-width: 0; }
@media (max-width: 800px) { .acc-form { grid-template-columns: 1fr; } }

/* Налаштування → Сервер */
.server-run { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin: 14px 0 6px; }
.server-run label { flex: 1 1 280px; min-width: 0; font-size: 13px; color: var(--muted); }
.server-run select { width: 100%; }
#server-block details { margin-top: 10px; } #server-block summary { cursor: pointer; }
#server-block code { overflow-wrap: anywhere; }

@media (max-width: 700px) {
  main { padding: 12px; }
  h1 { font-size: 21px; }
  img, input, select, textarea, video { max-width: 100%; }
  input[type=search] { width: 100%; }
  input[type=file] { width: 100%; }
  button, .button { padding: 11px 14px; }                                   /* зручніше натискати пальцем */
  .page-head { gap: 10px; }
  .head-tools, .buttons, .topbar-actions, .ofilters, .bulkbar { flex-wrap: wrap; }
  .two-cols { grid-template-columns: minmax(0, 1fr); }
  .fields, .form-grid, .filter-row { grid-template-columns: minmax(0, 1fr); }
  .panel, .block { padding: 14px; }
  .copy-line { flex-wrap: wrap; } .copy-line .feed-link { min-width: 0; flex-basis: 100%; }
  input[type=datetime-local], input[type=date] { width: 100%; min-width: 0; }
  .ofilters input[type=date] { width: auto; flex: 1 1 130px; }
  label[style*="min-width"] { min-width: 0 !important; }

  /* каталог: фільтри ховаються за кнопкою, товари — компактні рядки з мініатюрою */
  .catalog { flex-direction: column; align-items: stretch; gap: 0; }
  .filters-toggle { display: block; width: 100%; margin: 0 0 12px; text-align: left; }
  .filters { display: none; width: auto; max-height: none; position: static; }
  .filters.open { display: block; margin-bottom: 12px; }
  /* плитки: по 2 в ряд, квадратне фото зверху, під ним назва, код, ціна й наявність */
  .items.view-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .items.view-grid .card, .items.view-grid .card-link { flex-direction: column; min-width: 0; }
  .items.view-grid .thumb { height: auto; width: 100%; aspect-ratio: 1 / 1; flex: none; position: relative; overflow: hidden; }
  .items.view-grid .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
  .items.view-grid .info { padding: 8px 10px 10px; gap: 3px; min-width: 0; }
  .items.view-grid .title { -webkit-line-clamp: 3; font-size: 13.5px; line-height: 1.3; font-weight: 600; }
  .items.view-grid .meta.code { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .items.view-grid .row { flex-direction: column; align-items: flex-start; gap: 5px; }
  .items.view-grid .price { font-size: 15px; white-space: nowrap; }
  .items.view-grid .badge { font-size: 11px; }
  .items.view-grid .sel { top: 6px; left: 6px; background: var(--sel-bg); border-radius: 6px; padding: 3px 5px; }
  /* список: великі рядки — фото ліворуч (з галочкою), праворуч назва, код, ціна й наявність */
  .items.view-list .list-head { display: none; }
  .items.view-list .card { grid-template-columns: 104px minmax(0, 1fr); grid-template-rows: auto; column-gap: 12px; row-gap: 3px; align-items: start; padding: 10px 12px; position: relative; }
  .items.view-list .card > * { grid-row: auto; }
  .items.view-list .thumb { grid-column: 1; grid-row: 1 / span 4; width: 104px; height: 104px; border-radius: 8px; overflow: hidden; }
  .items.view-list .sel { position: absolute; top: 14px; left: 16px; grid-column: auto; grid-row: auto; padding: 3px 5px; background: var(--sel-bg); }
  .items.view-list .title { grid-column: 2; grid-row: 1; -webkit-line-clamp: 3; font-size: 14.5px; line-height: 1.3; font-weight: 600; color: var(--text); }
  .items.view-list .meta.code { display: block; grid-column: 2; grid-row: 2; font-size: 12.5px; }
  .items.view-list .meta.brand, .items.view-list .meta.group { display: none; }
  .items.view-list .row .pricebox { grid-column: 2; grid-row: 3; font-size: 16px; }
  .items.view-list .row .badge { grid-column: 2; grid-row: 4; justify-self: start; font-size: 12px; }
  .view-switch button { padding: 8px 10px; }

  /* картка товару */
  .main-photo { height: 240px; }
  .thumbs img { width: 56px; height: 56px; }
  .topbar { gap: 8px; }
  .savebar { flex-wrap: wrap; }
  .rte-bar { gap: 3px; }

  /* список замовлень: кожне замовлення — картка; ліворуч велике фото першої позиції (з галочкою), праворуч номер, сума, дата, покупець, статус */
  table.data.orders-table { display: block; overflow: visible; background: none; border: 0; }
  .orders-table thead { display: none; }
  .orders-table tbody { display: block; }
  .orders-table tr { display: grid; grid-template-columns: 128px minmax(0, 1fr) auto; column-gap: 12px; row-gap: 3px; position: relative;
    background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 10px; }
  table.data.orders-table td { border: 0; padding: 0; min-width: 0; }
  .orders-table td.chk { position: absolute; top: 16px; left: 16px; z-index: 2; line-height: 0; background: var(--sel-bg); border-radius: 6px; padding: 3px 5px; }
  .orders-table td.chk input { width: 18px; height: 18px; accent-color: var(--accent); }
  table.data.orders-table td.thumb-col { grid-column: 1; grid-row: 1 / span 4; width: auto; padding: 0; }
  .orders-table td:nth-child(3) { grid-column: 2; grid-row: 1; font-size: 16px; }
  .orders-table td:nth-child(10) { grid-column: 3; grid-row: 1; font-weight: 700; text-align: right; }
  .orders-table td:nth-child(4) { grid-column: 2; grid-row: 2; font-size: 12.5px; white-space: normal; min-width: 0; }
  .orders-table td:nth-child(6) { grid-column: 3; grid-row: 2; font-size: 13px; text-align: right; color: var(--muted); }
  .orders-table td:nth-child(5) { grid-column: 2 / 4; grid-row: 3; }
  .orders-table td:nth-child(7) { grid-column: 2 / 4; grid-row: 4; align-self: start; }
  .orders-table td:nth-child(8), .orders-table td:nth-child(9) { grid-column: 1 / 4; font-size: 14px; display: flex; align-items: baseline; gap: 8px; }
  .orders-table td:nth-child(8) .small, .orders-table td:nth-child(9) .small { margin-left: auto; text-align: right; }
  .orders-table td:nth-child(9)::before { content: "ТТН: "; color: var(--muted); }
  .orders-table td:nth-child(9):not(:has(.nowrap)) { display: none; }
  .orders-table td:nth-child(9) .nowrap { white-space: normal; }
  .orders-table .order-thumb { width: 128px; height: 128px; border-radius: 10px; }
  .orders-table .order-thumb.none { font-size: 40px; }

  /* позиції замовлення: рядок таблиці — картка з підписами */
  table#items { display: block; overflow: visible; background: none; border: 0; }
  table#items thead { display: none; }
  table#items tbody, table#items tfoot { display: block; }
  table#items tbody tr { display: grid; grid-template-columns: 60px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 6px 8px; position: relative;
    background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 10px; }
  table.data#items td { border: 0; padding: 0; min-width: 0; }
  table#items tbody td::before { display: block; font-size: 12px; color: var(--muted); }
  table#items tbody td.ph, table.data#items td.ph { grid-column: 1; grid-row: 1 / span 2; width: auto; aspect-ratio: auto; border: 0; background: none; overflow: visible; cursor: default; position: static; }
  table#items tbody td:nth-child(3) { grid-column: 2 / 5; grid-row: 1; padding-right: 26px; } table#items tbody td:nth-child(3)::before { content: "Назва"; }
  table#items tbody td:nth-child(2) { grid-column: 2 / 5; grid-row: 2; } table#items tbody td:nth-child(2)::before { content: "Артикул"; }
  table#items tbody td:nth-child(4) { grid-column: 1 / 3; } table#items tbody td:nth-child(4)::before { content: "Кількість"; }
  table#items tbody td:nth-child(5) { grid-column: 3; } table#items tbody td:nth-child(5)::before { content: "Ціна"; }
  table#items tbody td:nth-child(6) { grid-column: 4; text-align: right; font-weight: 600; } table#items tbody td:nth-child(6)::before { content: "Сума"; font-weight: 400; }
  table#items tbody td:nth-child(7) { position: absolute; top: 8px; right: 10px; }
  table#items input.num { width: 100%; }
  table#items tfoot tr { display: flex; justify-content: flex-end; gap: 8px; padding: 4px 2px; }
  table#items tfoot td { padding: 0; border: 0; }
  table#items tfoot td:last-child { display: none; }
  /* Облік */
  .acc-tabs { flex-wrap: nowrap; overflow-x: auto; } .acc-tabs a { padding: 9px 11px; white-space: nowrap; }
  .acc-month { width: 100%; } .acc-month select { flex: 1 1 auto; min-width: 0; }
  .acc-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); } .acc-kpi .stat .big { font-size: 19px; }
  .acc-strip { gap: 6px 12px; } .acc-strip .grow { display: none; }
  table.acc-journal, table.acc-pricelist { display: block; border: 0; background: none; overflow: visible; }
  table.acc-journal thead, table.acc-pricelist thead { display: none; }
  table.acc-journal tbody, table.acc-pricelist tbody { display: block; }
  table.acc-journal tr, table.acc-pricelist tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
  table.acc-journal td, table.acc-pricelist td { display: block; border: 0; padding: 0; text-align: left; background: none !important; }
  table.acc-journal td[data-label]:not(.acc-name)::before, table.acc-pricelist td[data-label]:not(.acc-name)::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
  table.acc-journal td.acc-name, table.acc-journal td.acc-act { grid-column: 1 / -1; max-width: none; min-width: 0; }
  table.acc-journal td.acc-name::before { content: none; }
  table.acc-journal tr.noprice { border-color: var(--warn-line); background: var(--warn-bg); }
  table.acc-journal td.num, table.acc-pricelist td.num { text-align: left; }
  table.acc-journal input.f-supplier, table.acc-journal input.num, table.acc-pricelist input.num, table.acc-journal td input:not([type=checkbox]) { width: 100%; }
  table.acc-journal td.acc-act { width: auto; text-align: right; } table.acc-journal td.acc-act:empty { display: none; }
  table.acc-pricelist tr { grid-template-columns: minmax(0, 1fr) 110px; grid-template-areas: "sup price" "code price" "name name"; align-items: center; }
  table.acc-pricelist td:nth-child(1) { grid-area: sup; font-size: 12px; color: var(--muted); } table.acc-pricelist td:nth-child(2) { grid-area: code; font-weight: 600; }
  table.acc-pricelist td:nth-child(3) { grid-area: name; } table.acc-pricelist td:nth-child(4) { grid-area: price; }
  table.acc-pricelist td:nth-child(1)::before, table.acc-pricelist td:nth-child(2)::before, table.acc-pricelist td:nth-child(3)::before { content: none !important; }
  table.acc-pricelist td.acc-act { position: absolute; right: 8px; top: 4px; } table.acc-pricelist tr { position: relative; }
  .acc-sum td.num { white-space: nowrap; } .acc-sum { width: 100%; }
}
