:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --text: #1d2520;
  --muted: #66736b;
  --line: #dde3dc;
  --brand: #1f7a4d;
  --brand-dark: #145638;
  --accent: #f0b429;
  --danger: #b42318;
  --shadow: 0 14px 40px rgba(28, 42, 32, 0.08);
}

:root[data-theme="dark"] {
  --bg: #111713;
  --surface: #18231d;
  --text: #eef5ef;
  --muted: #a8b6ad;
  --line: #2a3a30;
  --brand: #5dbb83;
  --brand-dark: #8bd3a6;
  --accent: #f0b429;
  --danger: #ff8b7f;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.24);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--brand); text-decoration: none; }
main { max-width: 1180px; margin: 0 auto; padding: 28px 20px 56px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 70px;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-bottom: 1px solid var(--line);
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; flex: 0 0 auto; }
.brand img { width: 42px; height: 42px; object-fit: contain; }
.top-mini-cart {
  position: relative;
}
.top-mini-cart-summary {
  min-height: 42px;
  display: grid;
  gap: 1px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--brand) 9%, var(--surface));
  color: var(--text);
}
.top-mini-cart-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.top-mini-cart-summary strong {
  font-size: 14px;
}
.top-mini-cart-panel {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 45;
  width: min(360px, calc(100vw - 24px));
  display: none;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.top-mini-cart:hover .top-mini-cart-panel,
.top-mini-cart:focus-within .top-mini-cart-panel {
  display: block;
}
.mini-cart-empty {
  color: var(--muted);
  padding: 8px;
}
.mini-cart-pop-list {
  max-height: 330px;
  overflow: auto;
  display: grid;
  gap: 6px;
}
.mini-cart-pop-store {
  margin-top: 6px;
  color: var(--brand-dark);
}
.mini-cart-pop-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.mini-cart-pop-row span {
  display: grid;
  gap: 2px;
}
.mini-cart-pop-row small {
  color: var(--muted);
}
.mini-cart-pop-total {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0;
}
.main-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.main-nav a,
.nav-group summary {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}
.main-nav strong { background: var(--brand); color: white; border-radius: 999px; padding: 1px 7px; }
.nav-link,
.nav-group summary {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 8px;
}
.nav-link.primary {
  background: var(--brand);
  color: #fff;
}
.nav-link.muted { color: var(--muted); }
.nav-group {
  position: relative;
}
.nav-group summary {
  list-style: none;
  cursor: pointer;
  background: color-mix(in srgb, var(--surface) 82%, var(--bg));
  border-color: var(--line);
}
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after {
  content: "v";
  font-size: 11px;
  color: var(--muted);
  margin-left: 2px;
}
.nav-group[open] summary {
  background: color-mix(in srgb, var(--brand) 12%, var(--surface));
  color: var(--brand-dark);
}
.nav-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 40;
  min-width: 210px;
  display: grid;
  gap: 4px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.nav-menu.wide {
  min-width: 360px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.nav-menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text);
  white-space: nowrap;
}
.nav-menu a:hover {
  background: color-mix(in srgb, var(--brand) 10%, var(--surface));
}
.theme-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand) 12%, var(--surface));
  color: var(--text);
  padding: 0 12px;
  font-weight: 700;
  cursor: pointer;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  min-height: 42px;
  padding: 0 18px;
  font-weight: 700;
  cursor: pointer;
}
.button:hover { background: var(--brand-dark); color: #fff; }
.button.ghost { background: color-mix(in srgb, var(--brand) 14%, var(--surface)); color: var(--brand-dark); }
.button.danger { background: #b91c1c; color: #fff; }
.button.small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.button.large { width: 100%; min-height: 52px; font-size: 16px; }

.hero {
  min-height: 520px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 380px;
  gap: 44px;
  align-items: center;
}
.hero h1, .page-head h1 { margin: 0; font-size: 44px; line-height: 1.06; letter-spacing: 0; }
.hero p { color: var(--muted); font-size: 18px; line-height: 1.6; max-width: 720px; }
.eyebrow { color: var(--brand); text-transform: uppercase; letter-spacing: .08em; font-size: 12px; font-weight: 800; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }
.actions.right { justify-content: flex-end; margin-top: 18px; }
.hero-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
  display: grid;
  gap: 12px;
}
.hero-panel strong { font-size: 20px; }
.hero-panel span { padding: 12px; background: color-mix(in srgb, var(--brand) 8%, var(--surface)); border: 1px solid var(--line); border-radius: 6px; }

.band { margin-top: 18px; padding: 34px 0; }
.band h2, .panel h2 { margin: 0 0 18px; }
.steps, .grid.products, .cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.steps article, .product, .order-card, .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 8px 22px rgba(28,42,32,.04);
}
.steps b { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; }
.steps p, .date, .empty, .order-card p { color: var(--muted); }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
.page-head p { color: var(--muted); max-width: 760px; }

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 220px auto;
  gap: 10px;
  margin-bottom: 18px;
}

.catalog-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.catalog-sidebar {
  position: sticky;
  top: 92px;
  max-height: calc(100vh - 112px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 8px 22px rgba(28,42,32,.04);
}
.catalog-sidebar:focus-within,
.catalog-sidebar:hover {
  outline: 1px solid color-mix(in srgb, var(--brand) 18%, transparent);
}
.filter-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--brand) 12%, var(--surface));
  border-radius: 8px;
}
.filter-title strong { font-size: 18px; }
.filter-title a { font-size: 13px; font-weight: 800; }
.filter-block {
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.filter-block h3 { margin: 0 0 10px; font-size: 15px; }
.check-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  color: var(--text);
  font-weight: 500;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
}
.check-row:hover { background: color-mix(in srgb, var(--brand) 8%, var(--surface)); }
.check-row:has(input:checked) {
  background: color-mix(in srgb, var(--brand) 14%, var(--surface));
  outline: 1px solid color-mix(in srgb, var(--brand) 45%, var(--line));
}
.check-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.check-row b { font-size: 14px; }
.check-row .count { color: var(--muted); font-size: 12px; }
.store-filter {
  grid-template-columns: 42px 1fr;
  min-height: 48px;
}
.store-logo {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: #f3f7f4;
  border: 1px solid var(--line);
  color: #1f2933;
  font-size: 10px;
  font-weight: 900;
  overflow: hidden;
}
.store-all { background: #f9fafb; color: var(--muted); font-size: 9px; }
.store-logo-albert { background: #e8f3ff; color: #00539f; }
.store-logo-billa { background: #fff7d1; color: #c40018; }
.store-logo-dm-drogerie { background: #eaf3ff; color: #e2001a; }
.store-logo-globus { background: #ecf7ff; color: #0050a4; }
.store-logo-kaufland { background: #fff1f0; color: #e30613; }
.store-logo-tesco { background: #eef3ff; color: #00539f; }
.filter-dot, .filter-icon {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--brand) 18%, var(--surface));
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 900;
}
.filter-dot::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brand);
}
.filter-dot.all::before { background: var(--accent); }
.catalog-main { min-width: 0; }
.page-head.compact { align-items: center; }
.page-head.compact h1 { font-size: 34px; }
.catalog-click-help {
  margin-top: 8px;
  color: var(--brand-dark) !important;
  font-weight: 800;
}
.catalog-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 240px) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.product-request-panel { margin-top: 18px; }
.product-request-panel p { color: var(--muted); margin-top: -4px; }
.product-request-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
}
.segmented {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 70%, var(--surface));
}
.segmented a {
  color: var(--text);
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 13px;
}
.segmented a.active { background: var(--brand); color: #fff; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 42px;
  padding: 9px 11px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.cell-input {
  min-width: 86px;
  max-width: 110px;
  min-height: 36px;
}
textarea { min-height: 92px; resize: vertical; }
label { display: grid; gap: 7px; font-weight: 700; font-size: 14px; }

.products.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 16px;
}
.products.products-list {
  display: grid;
  gap: 12px;
}
.product { display: grid; gap: 10px; cursor: pointer; position: relative; transition: background .15s ease, border-color .15s ease, box-shadow .15s ease; }
.product:hover {
  background: color-mix(in srgb, var(--brand) 8%, var(--surface));
  border-color: color-mix(in srgb, var(--brand) 38%, var(--line));
  box-shadow: 0 10px 26px rgba(28,42,32,.08);
}
.product.just-added {
  background: color-mix(in srgb, var(--brand) 9%, var(--surface));
  border-color: color-mix(in srgb, var(--brand) 45%, var(--line));
}
.product.just-added::after {
  content: "Pridano do kosiku";
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  padding: 6px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand) 92%, #10291b);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(24, 76, 48, .22);
  pointer-events: none;
}
.product.muted { opacity: .72; }
.product .image {
  position: relative;
  height: 150px;
  display: grid;
  place-items: center;
  background: #f3f5f1;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}
.product .image::before {
  content: "✓";
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  background: rgba(31, 122, 77, .78);
  color: #fff;
  font-size: 74px;
  font-weight: 900;
  opacity: 0;
  transform: scale(.92);
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}
.product.just-added .image::before {
  opacity: 1;
  transform: scale(1);
}
.product .image img { max-width: 100%; max-height: 100%; object-fit: contain; }
.product .image img:hover {
  transform: scale(1.02);
}
.product .image:has(img):hover::after {
  content: "";
  position: fixed;
  z-index: 500;
  width: 340px;
  height: 340px;
  left: min(55vw, calc(100vw - 380px));
  top: 110px;
  background: var(--surface) var(--preview-image) center / contain no-repeat;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  pointer-events: none;
}
.product h3 { min-height: 44px; margin: 0; font-size: 16px; line-height: 1.35; }
.product-body { display: grid; gap: 9px; }
.products-list .product {
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  padding: 10px 12px;
}
.products-list .product .image { height: 48px; }
.product .image::before {
  content: "\2713";
  left: 6px;
  top: 6px;
  inset: auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 22px;
  transform: scale(.82);
}
.product.just-added .image::before { transform: scale(1); }
.products-list .product .image::before {
  left: 4px;
  top: 4px;
  width: 22px;
  height: 22px;
  font-size: 14px;
}
.products-list .product.just-added::after { display: none; }
.products-list .product h3 { min-height: auto; font-size: 15px; }
.products-list .product-body {
  grid-template-columns: minmax(220px, 1fr) auto auto;
  align-items: center;
  gap: 12px;
}
.products-list .meta,
.products-list .product-facts { display: none; }
.products-list .date { margin: 0; font-size: 13px; }
.products-list .price { font-size: 18px; white-space: nowrap; }
.products-list .add-form { min-width: 260px; }
.products-list .offer-strip,
.products-list .price-hint { display: none; }
.products-list .grouped-add-form { min-width: 360px; }
.meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.badge { background: #e8f2ec; color: var(--brand-dark); border-radius: 999px; padding: 4px 9px; font-size: 12px; font-weight: 800; }
.badge.warn { background: #fff0d0; color: #8a5a00; }
.price { font-size: 22px; font-weight: 800; }
.price small { font-size: 12px; color: var(--muted); }
.offer-strip {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.store-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 7px;
  background: color-mix(in srgb, var(--surface) 88%, var(--bg));
  color: var(--muted);
}
.store-chip b {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--brand) 12%, var(--surface));
  color: var(--brand-dark);
  font-size: 11px;
}
.store-chip small { font-size: 12px; font-weight: 800; }
.store-chip.best {
  border-color: color-mix(in srgb, var(--accent) 70%, var(--line));
}
.store-chip.selected {
  background: color-mix(in srgb, var(--brand) 13%, var(--surface));
  color: var(--text);
}
.price-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.product-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.product-facts span {
  background: color-mix(in srgb, var(--brand) 10%, var(--surface));
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 12px;
}
.product-facts span.ok {
  color: var(--brand-dark);
}
.product-facts span.blocked {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
}
button:disabled,
input:disabled {
  opacity: .55;
  cursor: not-allowed;
}
.add-form { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; }
.grouped-add-form { grid-template-columns: minmax(130px, 1fr) auto; }
.offer-select { min-height: 34px; font-size: 13px; }
.click-add-hint {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.add-form.added {
  outline: 0;
}
.add-form.add-error {
  outline: 2px solid color-mix(in srgb, var(--danger) 55%, transparent);
  border-radius: 8px;
}
.compact-stepper {
  grid-template-columns: 30px 58px 30px;
  min-width: 128px;
}
.compact-stepper button {
  width: 30px;
  height: 30px;
  font-size: 18px;
}
.catalog-qty {
  width: 58px;
  min-width: 58px;
  min-height: 36px;
  text-align: center;
}

.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; }
th { background: #f8faf8; color: var(--muted); font-size: 13px; }
.cart-group td {
  background: #eef6f1;
  color: var(--brand-dark);
  font-weight: 800;
}
.cart-subgroup td {
  background: #fafbf8;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.cart-product-cell {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 10px;
  align-items: center;
}
.cart-product-cell img, .cart-product-cell > span {
  width: 54px;
  height: 54px;
  object-fit: contain;
  background: #f3f5f1;
  border-radius: 6px;
}
.cart-product-cell strong { display: block; }
.validity { color: #078000 !important; }
.qty {
  width: 76px;
  min-width: 76px;
  text-align: center;
  padding-left: 8px;
  padding-right: 8px;
}
.qty-stepper {
  display: inline-grid;
  grid-template-columns: 34px 76px 34px;
  gap: 8px;
  align-items: center;
  justify-content: start;
  min-width: 160px;
}
.qty-stepper button,
.import-qty button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}
.qty-minus, .preview-minus { background: #5f6f52; }
.qty-plus, .preview-plus { background: #1f7a4d; }
.qty-stepper button:hover,
.import-qty button:hover { filter: brightness(.92); }
.remove-row {
  width: 32px;
  height: 32px;
  border: 1px solid #ffd2cc;
  border-radius: 6px;
  background: #fff1f0;
  color: var(--danger);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.summary {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.summary.total { max-width: 520px; margin-left: auto; }
.summary strong { font-size: 18px; }

.checkout { display: grid; gap: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.wide { grid-column: 1 / -1; }
.replacement {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.launch-note {
  display: grid;
  gap: 4px;
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
}
.launch-note span {
  color: var(--muted);
}
.terms-check {
  justify-content: flex-end;
  margin: 4px 0 12px;
}
.settings-form textarea {
  min-height: 120px;
}

.auth { min-height: 64vh; display: grid; place-items: center; }
.auth .panel, .narrow { width: min(100%, 460px); }
.auth h1 { margin-top: 0; }
.panel { margin-bottom: 16px; }

.flash {
  margin-bottom: 16px;
  border-radius: 8px;
  padding: 12px 14px;
  background: color-mix(in srgb, var(--brand) 12%, var(--surface));
  border: 1px solid #cde5d6;
}
.flash.error { background: #fff1f0; border-color: #ffd2cc; color: var(--danger); }
.flash.warning { background: #fff8e6; border-color: #f5df9e; }
.flash.success { background: #eef8f1; border-color: #cfead8; }
.empty { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 24px; }

.order-card { display: grid; gap: 8px; }
.order-card > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.admin-grid { display: grid; grid-template-columns: 1.5fr .8fr; gap: 18px; align-items: start; }
.dispatch-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.admin-products-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}
.category-manager {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}
.category-tree {
  display: grid;
  gap: 10px;
}
.category-branch {
  display: grid;
  gap: 8px;
}
.category-children {
  display: grid;
  gap: 8px;
  margin: -2px 0 8px 28px;
  padding-left: 14px;
  border-left: 2px solid color-mix(in srgb, var(--brand) 22%, var(--line));
}
.category-children.collapsed { display: none; }
.category-node {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}
.category-node.level-1 {
  background: color-mix(in srgb, var(--brand) 9%, var(--surface));
}
.category-node-main {
  display: grid;
  grid-template-columns: 28px 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}
.category-node strong { display: block; }
.category-node small { display: block; color: var(--muted); margin-top: 3px; }
.category-badge {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
}
.category-dot {
  width: 14px;
  height: 14px;
  display: inline-block;
  justify-self: center;
  border-radius: 50%;
  background: var(--brand);
}
.category-dot.warn { background: var(--danger); }
.category-toggle,
.category-toggle-placeholder {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
}
.category-toggle {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
}
.category-node-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.category-node.level-3 { margin-left: 4px; }
.category-node.level-4 { margin-left: 8px; }
.category-node.level-5 { margin-left: 12px; }
.category-editor {
  position: sticky;
  top: 92px;
}
.category-help {
  margin-top: 16px;
  padding: 12px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--brand) 8%, var(--surface));
  color: var(--muted);
}
.category-help p { margin-bottom: 0; }
.product-admin-list, .admin-list {
  display: grid;
  gap: 12px;
}
.product-admin-card, .admin-edit-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: color-mix(in srgb, var(--surface) 92%, var(--bg));
}
.product-admin-head {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.product-admin-head img, .product-admin-head > span {
  width: 58px;
  height: 58px;
  object-fit: contain;
  background: #f3f5f1;
  border-radius: 6px;
}
.product-admin-head strong { display: block; }
.product-admin-head small { color: var(--muted); }
.inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.inline-check input { width: auto; min-height: auto; }
.form-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.admin-edit-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 240px) auto;
  gap: 10px;
  align-items: end;
}
.zone-edit-row {
  grid-template-columns: minmax(150px, 1fr) 90px 120px minmax(160px, 1fr) 110px auto;
}
.user-edit-row {
  grid-template-columns: minmax(190px, 1.4fr) minmax(130px, 1fr) minmax(110px, .8fr) minmax(110px, .8fr) 130px auto;
}
.inventory-edit-row {
  grid-template-columns: minmax(230px, 1.5fr) 170px 78px 78px 140px 140px minmax(130px, .8fr) auto;
}
.route-edit-row {
  grid-template-columns: minmax(150px, 1fr) 90px 110px 78px minmax(150px, 1fr) minmax(170px, 1.2fr) 110px auto;
}
.user-edit-row small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}
.inventory-product {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}
.inventory-product img, .inventory-product > span {
  width: 44px;
  height: 44px;
  object-fit: contain;
  background: #f3f5f1;
  border-radius: 6px;
}
.inventory-product strong,
.inventory-product small {
  display: block;
}
.inventory-product small { color: var(--muted); margin-top: 2px; }
.stock-warn { color: var(--danger) !important; font-weight: 800; }
.route-edit-row textarea {
  min-height: 44px;
}
.reject-form {
  border: 1px solid #fecaca;
  background: rgba(254, 226, 226, .42);
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
}
[data-theme="dark"] .reject-form {
  border-color: #7f1d1d;
  background: rgba(127, 29, 29, .22);
}
.dispatch-filter { grid-template-columns: 220px 1fr auto; }
.route-order {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 8px;
}
.dispatch-stops { display: grid; gap: 10px; }
.dispatch-stop {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.dispatch-stop > b {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
}
.dispatch-stop h3 { margin: 0 0 4px; }
.dispatch-stop p { margin: 0; color: var(--text); }
.dispatch-stop small { color: var(--muted); }
.shopper-list {
  display: grid;
  gap: 10px;
}
.shopper-item {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 90px 150px minmax(150px, .6fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.shopper-item strong { display: block; }
.shopper-item small { display: block; color: var(--muted); margin-top: 3px; }
.scanner-panel {
  display: grid;
  grid-template-columns: 170px 220px minmax(240px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 18px;
}
.scanner-input input {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: .06em;
}
.scanner-match {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 120px auto;
  gap: 10px;
  align-items: end;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.text-page { line-height: 1.65; }
.print-actions { margin-bottom: 12px; }
@media print {
  .topbar, footer, .filters, .print-actions, .flash { display: none !important; }
  body { background: #fff; color: #000; }
  main { max-width: none; padding: 0; }
  .panel { box-shadow: none; border: 0; }
  .shopper-item { break-inside: avoid; grid-template-columns: 1fr 80px 120px 1fr; }
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat-grid article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.stat-grid span { display: block; color: var(--muted); font-size: 13px; }
.stat-grid strong { display: block; margin-top: 6px; font-size: 30px; }
.launch-checklist { margin-bottom: 18px; }
.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}
.launch-check {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 90%, var(--bg));
}
.launch-check strong { font-size: 12px; text-transform: uppercase; }
.launch-check.ok strong { color: var(--brand-dark); }
.launch-check.warn strong { color: var(--danger); }
.launch-check small { color: var(--muted); }
.admin-order {
  display: grid;
  grid-template-columns: 1fr 180px 150px;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.request-card {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 160px minmax(240px, 1fr) minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.request-card small,
.request-card p { color: var(--muted); margin: 4px 0 0; }
.admin-order span, .import-row span, .import-row small { display: block; color: var(--muted); font-size: 13px; }
.order-group {
  margin: 18px 0 8px;
  padding: 10px 12px;
  background: #f4f8f5;
  border: 1px solid #dce9df;
  border-radius: 8px;
  font-size: 15px;
}
.admin-actions { display: flex; gap: 8px; justify-content: flex-end; }
.order-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.order-toolbar > div { display: flex; align-items: center; gap: 12px; }
.order-toolbar form { display: grid; grid-template-columns: 180px auto; gap: 8px; }
.approve-form { margin-bottom: 18px; }
.save-state { color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.import-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.import-url-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: end;
}
.import-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, .8fr);
  gap: 18px;
  align-items: start;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.panel-head h2 { margin-bottom: 4px; }
.panel-head p { margin: 0; color: var(--muted); }
.import-list {
  display: grid;
  gap: 10px;
  max-height: 620px;
  overflow: auto;
  padding-right: 4px;
}
.import-item {
  display: grid;
  grid-template-columns: 24px 72px 1fr 134px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 400;
}
.import-item.disabled { opacity: .58; background: #f8f3f1; }
.import-item .thumb {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  background: #f3f5f1;
  border-radius: 6px;
  overflow: hidden;
}
.import-item img { max-width: 100%; max-height: 100%; object-fit: contain; }
.import-item strong, .mini-cart strong { display: block; }
.import-item small, .mini-cart small { display: block; color: var(--muted); margin-top: 4px; }
.import-item b { display: block; margin-top: 8px; font-size: 18px; }
.import-qty {
  display: grid;
  grid-template-columns: 34px 76px 34px;
  gap: 8px;
  align-items: center;
  min-width: 160px;
}
.import-qty input {
  min-height: 36px;
  padding: 6px 8px;
  text-align: center;
  width: 76px;
  min-width: 76px;
}
.mini-cart { display: grid; gap: 10px; }
.mini-cart-store {
  margin: 8px 0 0;
  padding: 8px 10px;
  background: #eef6f1;
  border-radius: 6px;
  font-size: 15px;
}
.mini-cart-category {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.mini-cart-row {
  display: grid;
  grid-template-columns: 1fr auto 32px;
  gap: 10px;
  align-items: start;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.remove-form { margin: 0; }
.remove-form button {
  width: 30px;
  height: 30px;
  border: 1px solid #ffd2cc;
  border-radius: 6px;
  background: #fff1f0;
  color: var(--danger);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}
footer span:first-child { color: var(--text); font-weight: 800; }

@media (max-width: 860px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar-left { width: 100%; }
  .top-mini-cart { width: 100%; }
  .top-mini-cart-summary { width: 100%; }
  .top-mini-cart-panel { left: 0; right: 0; width: 100%; }
  .main-nav { justify-content: flex-start; width: 100%; }
  .nav-group { position: static; }
  .nav-menu,
  .nav-menu.wide {
    position: static;
    min-width: 0;
    width: min(100%, 360px);
    grid-template-columns: 1fr;
    margin-top: 6px;
  }
  .hero, .steps, .grid.products, .cards, .admin-grid, .catalog-shell, .dispatch-layout, .admin-products-layout, .category-manager { grid-template-columns: 1fr; }
  .hero { min-height: auto; padding: 28px 0; }
  .hero h1, .page-head h1 { font-size: 34px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .filters, .form-grid, .form-grid.compact, .replacement, .admin-order, .stat-grid, .order-toolbar form, .import-url-form, .import-layout, .catalog-toolbar, .dispatch-filter, .dispatch-stop, .admin-edit-row, .product-admin-head, .shopper-item, .inventory-edit-row, .route-edit-row, .product-request-form, .request-card, .scanner-panel, .scanner-match { grid-template-columns: 1fr; }
  .catalog-sidebar { position: static; max-height: none; overflow: visible; }
  .category-editor { position: static; }
  .category-children { margin-left: 0; padding-left: 10px; }
  .category-node { grid-template-columns: 1fr; }
  .category-node-actions { justify-content: flex-start; }
  .products-list .product { grid-template-columns: 1fr; }
  .products-list .product-body { grid-template-columns: 1fr; }
  .products-list .add-form, .products-list .grouped-add-form { min-width: 0; grid-template-columns: 1fr; }
  .order-toolbar { align-items: flex-start; flex-direction: column; }
  .admin-actions { justify-content: flex-start; }
  .import-item { grid-template-columns: 24px 58px 1fr; }
  .import-qty { grid-column: 3; max-width: 170px; }
  footer { flex-direction: column; }
}
