:root {
  --bg: #f6f4ef;
  --card: #ffffff;
  --ink: #1d2a24;
  --muted: #6b7570;
  --line: #e4e1d8;
  --green: #1f5640;
  --green-2: #2d7457;
  --green-soft: #e6f0ea;
  --rose: #d6457a;
  --rose-soft: #fde9f0;
  --warn: #b7791f;
  --warn-soft: #fdf3e1;
  --err: #c0392b;
  --err-soft: #fbe9e7;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 40, 30, .06), 0 4px 14px rgba(20, 40, 30, .06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--green-2); }
h1 { font-size: 26px; margin: 6px 0 4px; letter-spacing: -.01em; }
h2 { font-size: 18px; margin: 0 0 10px; }
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 18px; }
.main { padding-top: 18px; padding-bottom: 90px; min-height: 70vh; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.mt { margin-top: 18px; }
.r { text-align: right; } .c { text-align: center; } .nowrap { white-space: nowrap; }
code { background: #efece4; padding: 1px 5px; border-radius: 5px; font-size: 13px; }

/* ---------- шапка ---------- */
.top { background: var(--green); color: #fff; position: sticky; top: 0; z-index: 30; box-shadow: 0 2px 10px rgba(0,0,0,.12); }
.top-in { display: flex; align-items: center; gap: 18px; min-height: 58px; flex-wrap: wrap; }
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--rose); font-size: 17px; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav a { color: #d8e7df; text-decoration: none; padding: 8px 12px; border-radius: 9px; white-space: nowrap; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.on { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.top-right { display: flex; align-items: center; gap: 10px; }
.cart-btn { display: flex; align-items: center; gap: 7px; color: #fff; text-decoration: none; background: rgba(255,255,255,.12); padding: 8px 12px; border-radius: 10px; font-weight: 600; }
.cart-btn.on, .cart-btn:hover { background: rgba(255,255,255,.22); }
.cart-n:not(:empty) { background: var(--rose); color: #fff; border-radius: 99px; padding: 0 7px; font-size: 12px; min-width: 20px; text-align: center; }
.user { position: relative; }
.user summary { list-style: none; cursor: pointer; padding: 8px 10px; border-radius: 9px; color: #d8e7df; font-size: 14px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user summary::-webkit-details-marker { display: none; }
.user summary:hover { background: rgba(255,255,255,.08); }
.user-menu { position: absolute; right: 0; top: 110%; background: #fff; border-radius: 12px; box-shadow: var(--shadow); min-width: 190px; padding: 6px; z-index: 40; }
.user-menu a, .user-menu button { display: block; width: 100%; text-align: left; padding: 9px 12px; color: var(--ink); text-decoration: none; border: 0; background: none; font: inherit; border-radius: 8px; cursor: pointer; }
.user-menu a:hover, .user-menu button:hover { background: var(--bg); }
.subnav { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.subnav a { padding: 7px 14px; border-radius: 99px; background: #fff; border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 14px; }
.subnav a.on { background: var(--green); color: #fff; border-color: var(--green); }

/* ---------- элементы ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #c9c4b6; }
.btn.primary { background: var(--rose); border-color: var(--rose); color: #fff; }
.btn.primary:hover { background: #c23468; }
.btn.primary:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--err); }
.btn.big { padding: 13px 20px; font-size: 16px; width: 100%; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.link { background: none; border: 0; color: var(--green-2); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; text-underline-offset: 2px; }
.link.danger { color: var(--err); }
input, select, textarea { font: inherit; color: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(45, 116, 87, .25); border-color: var(--green-2); }
input[type=checkbox] { width: auto; accent-color: var(--rose); }
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 5px; font-size: 14px; font-weight: 600; color: #3b463f; }
.form label.chk, label.chk { display: flex; align-items: center; gap: 7px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.grid2f { grid-template-columns: 1fr 1fr; }
.span2 { grid-column: 1 / -1; }
.inl { display: inline; }
label.inl { display: inline-flex; align-items: center; gap: 6px; }
label.inl input { width: auto; }
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.flash { padding: 11px 14px; border-radius: 10px; margin-bottom: 12px; background: var(--green-soft); color: #174532; border: 1px solid #cfe3d7; }
.flash.err { background: var(--err-soft); color: #8c2a1f; border-color: #f2cdc7; }
.flash.warn { background: var(--warn-soft); color: #7a5214; border-color: #f1dfbc; }
.note { background: #fff; border-left: 4px solid var(--green-2); padding: 10px 14px; border-radius: 8px; margin: 10px 0; box-shadow: var(--shadow); }
.note.mgr { border-left-color: var(--rose); }
.warn { background: var(--warn-soft); color: #7a5214; padding: 10px 12px; border-radius: 10px; font-size: 13px; margin: 6px 0 12px; }
.empty { background: #fff; padding: 40px 20px; text-align: center; border-radius: var(--radius); color: var(--muted); box-shadow: var(--shadow); }
.b { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: #f0eee7; color: #47514b; font-weight: 600; white-space: nowrap; }
.b.grade { background: var(--rose-soft); color: #a3285a; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 600; }
.st { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; vertical-align: middle; }
.st-new { background: var(--rose-soft); color: #a3285a; }
.st-accepted { background: #e5effa; color: #1f5a96; }
.st-ordered { background: var(--warn-soft); color: #8a5a12; }
.st-done { background: var(--green-soft); color: #1d5a3f; }
.st-cancelled { background: #eee; color: #777; }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 30px); background: #1d2a24; color: #fff; padding: 10px 18px; border-radius: 99px; opacity: 0; transition: .25s; pointer-events: none; z-index: 60; font-size: 14px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--err); }

/* ---------- вход ---------- */
.login-box { max-width: 380px; margin: 40px auto; background: #fff; padding: 30px 28px; border-radius: 20px; box-shadow: var(--shadow); text-align: center; }
.login-box .form { text-align: left; margin-top: 18px; }
.login-art { width: 64px; height: 64px; margin: 0 auto 6px; border-radius: 50%; background: var(--rose-soft); color: var(--rose); display: grid; place-items: center; font-size: 34px; }

/* ---------- каталог ---------- */
.cat-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.cat-head p { margin: 2px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: #fff; padding: 10px; border-radius: var(--radius); box-shadow: var(--shadow); position: sticky; top: 64px; z-index: 20; }
.toolbar select { width: auto; }
.search { position: relative; flex: 1; min-width: 220px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 36px; }
.cat-head .search input { padding-left: 11px; }
.view-sw { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.view-sw button { border: 0; background: #fff; padding: 8px 12px; cursor: pointer; font-size: 16px; color: var(--muted); }
.view-sw button.on { background: var(--green); color: #fff; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 12px 0 8px; scrollbar-width: thin; }
.chip { border: 1px solid var(--line); background: #fff; padding: 6px 12px; border-radius: 99px; cursor: pointer; white-space: nowrap; font: inherit; font-size: 14px; color: var(--ink); }
.chip span { color: var(--muted); font-size: 12px; margin-left: 2px; }
.chip.on { background: var(--green); color: #fff; border-color: var(--green); }
.chip.on span { color: #cde3d7; }

.products.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 14px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; border: 2px solid transparent; transition: border-color .15s; }
.card.in-cart { border-color: var(--rose); }
.ph { position: relative; aspect-ratio: 4 / 3; background: #faf9f6; display: grid; place-items: center; cursor: zoom-in; }
.ph img { max-width: 92%; max-height: 92%; object-fit: contain; }
.noimg { font-size: 40px; color: #d9d4c7; }
.fav { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(255,255,255,.92); color: #c9c3b6; font-size: 18px; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.1); line-height: 1; }
.fav.on { color: var(--rose); }
.fav:hover { transform: scale(1.08); }
.numtag { position: absolute; left: 8px; top: 8px; font-size: 11px; background: rgba(255,255,255,.9); padding: 2px 7px; border-radius: 99px; color: var(--muted); font-weight: 600; }
.body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.genus { font-size: 13px; color: var(--green-2); font-weight: 700; }
.genus .en { color: var(--muted); font-weight: 500; }
.variety { font-size: 18px; font-weight: 700; line-height: 1.2; }
.badges { display: flex; gap: 5px; flex-wrap: wrap; }
.specs { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0; font-size: 13px; }
.specs dt { color: var(--muted); }
.specs dd { margin: 0; font-weight: 600; }
.pnote { font-size: 12px; color: #7a5214; background: var(--warn-soft); padding: 5px 8px; border-radius: 7px; }
.price-row { margin-top: auto; padding-top: 4px; }
.price { font-size: 20px; font-weight: 800; color: var(--green); }
.price small { font-size: 13px; font-weight: 500; color: var(--muted); }
.buy { display: flex; gap: 8px; align-items: center; }
.qty { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; flex: 1; min-width: 0; }
.qty button { border: 0; background: #f5f3ee; width: 36px; height: 38px; font-size: 20px; cursor: pointer; color: var(--green); flex: none; }
.qty button:hover { background: var(--green-soft); }
.qty input { border: 0; border-radius: 0; text-align: center; padding: 6px 2px; min-width: 46px; width: 100%; font-weight: 700; -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty input:focus { outline: none; }
.qty .u { font-size: 12px; color: var(--muted); padding-right: 6px; }
.addbox { padding: 8px 10px; font-size: 13px; }
.line-info { font-size: 13px; color: var(--rose); min-height: 18px; }

/* вид списком */
.products.list { display: flex; flex-direction: column; gap: 8px; }
.products.list .card { flex-direction: row; align-items: center; }
.products.list .ph { width: 92px; aspect-ratio: 1; flex: none; }
.products.list .numtag { display: none; }
.products.list .fav { width: 28px; height: 28px; font-size: 15px; top: 4px; right: 4px; }
.products.list .body { display: grid; grid-template-columns: minmax(180px, 1.4fr) minmax(170px, 1.2fr) minmax(120px, .8fr) 250px; align-items: center; gap: 4px 16px; padding: 8px 14px; }
.products.list .genus, .products.list .variety { grid-column: 1; }
.products.list .variety { font-size: 16px; }
.products.list .badges { grid-column: 1; }
.products.list .specs { grid-column: 2; grid-row: 1 / span 3; }
.products.list .pnote { grid-column: 2; }
.products.list .price-row { grid-column: 3; grid-row: 1 / span 3; margin: 0; }
.products.list .price { font-size: 17px; }
.products.list .buy { grid-column: 4; grid-row: 1 / span 2; }
.products.list .line-info { grid-column: 4; }

.cart-float { position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, 120px); background: var(--green); color: #fff; text-decoration: none; display: flex; gap: 16px; align-items: center; padding: 12px 20px; border-radius: 99px; box-shadow: 0 8px 24px rgba(0,0,0,.2); transition: .25s; z-index: 25; white-space: nowrap; }
.cart-float.show { transform: translate(-50%, 0); }
.cart-float .go { background: var(--rose); padding: 5px 12px; border-radius: 99px; font-weight: 700; }
.lightbox { position: fixed; inset: 0; background: rgba(10, 20, 15, .8); display: none; place-items: center; z-index: 70; cursor: zoom-out; }
.lightbox.show { display: grid; }
.lightbox img { max-width: 90vw; max-height: 85vh; background: #fff; border-radius: 12px; padding: 10px; image-rendering: auto; min-width: min(420px, 90vw); }

/* ---------- корзина ---------- */
.cart-layout { display: grid; grid-template-columns: 1fr 330px; gap: 18px; align-items: start; }
.cart-group { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.cg-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.cg-head h2 { margin: 0; }
.cg-box { font-size: 13px; color: var(--muted); min-width: 220px; }
.cg-box b { color: var(--ink); }
.bar { height: 6px; background: #eeebe3; border-radius: 99px; margin-top: 5px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--green-2); border-radius: 99px; transition: width .2s; }
.cg-box.partial .bar i { background: var(--warn); }
.cline { display: grid; grid-template-columns: 64px 1fr 210px 120px; gap: 14px; align-items: center; padding: 12px 16px; border-bottom: 1px solid #f1eee7; transition: opacity .3s; }
.cline:last-child { border-bottom: 0; }
.cl-img { width: 64px; height: 64px; display: grid; place-items: center; background: #faf9f6; border-radius: 10px; color: #d9d4c7; font-size: 24px; }
.cl-img img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.cl-title { font-size: 15px; }
.cl-qty { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.cl-qty .qty { width: 100%; }
.cl-sum { text-align: right; font-weight: 800; font-size: 16px; }
.sticky { position: sticky; top: 76px; }
.tot { margin-bottom: 12px; }
.tot .big { font-size: 20px; color: var(--ink); }
.tot dd.big { color: var(--green); }

/* ---------- таблицы ---------- */
.table-wrap { overflow-x: auto; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 11px 12px; border-bottom: 1px solid var(--line); background: #fbfaf7; white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid #f1eee7; vertical-align: middle; }
.tbl th.r { text-align: right; }
.tbl tfoot td { background: #fbfaf7; border-bottom: 0; }
.tbl tr.rowlink { cursor: pointer; }
.tbl tr.rowlink:hover td { background: #fbfaf5; }
.tbl tr.off td { opacity: .5; }
.tbl .thumb { width: 52px; }
.tbl .thumb img { width: 44px; height: 44px; object-fit: contain; border-radius: 6px; }
.tbl.edit input { padding: 6px 8px; font-size: 13px; }
.tbl.edit select { padding: 6px; font-size: 13px; width: auto; }
.tbl.edit input.num { width: 90px; text-align: right; }
.tbl.edit input.num.s { width: 64px; }
.tbl tr.dirty td { background: #fffbe9; }
.qin { width: 80px; text-align: right; padding: 5px 8px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters select { width: auto; }
.save-bar { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 30%); }
.save-bar .btn { width: auto; }
.offer summary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; cursor: pointer; list-style: none; }
.offer summary::-webkit-details-marker { display: none; }
.offer { margin-bottom: 10px; }
.offer.off { opacity: .7; }
.grow { flex: 1; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #c9c4b6; }
.dot.on { background: #2fa36b; box-shadow: 0 0 0 3px #d5f0e2; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.help { margin-top: 14px; font-size: 14px; }
.help summary { cursor: pointer; color: var(--green-2); font-weight: 600; }
.foot { color: var(--muted); font-size: 13px; padding: 20px 18px 30px; text-align: center; }

/* ---------- адаптив ---------- */
@media (max-width: 960px) {
  .cart-layout { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .products.list .body { grid-template-columns: 1fr 1fr; }
  .products.list .specs, .products.list .price-row, .products.list .buy, .products.list .line-info, .products.list .pnote { grid-column: auto; grid-row: auto; }
}
@media (max-width: 720px) {
  .wrap { padding: 0 12px; }
  h1 { font-size: 22px; }
  .top-in { gap: 8px; padding: 6px 0; }
  .nav { order: 3; flex-basis: 100%; }
  .top-right { margin-left: auto; }
  .user summary { max-width: 120px; }
  .toolbar { position: static; gap: 8px; }
  .toolbar .search { flex-basis: 100%; }
  .toolbar select { flex: 1 1 40%; min-width: 0; padding: 8px; font-size: 14px; }
  .toolbar label.chk { font-size: 14px; }
  .view-sw { margin-left: auto; }
  .qty .u { display: none; }
  .products.grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .body { padding: 10px; }
  .variety { font-size: 16px; }
  .buy { flex-direction: column; align-items: stretch; }
  .qty button { width: 32px; }
  .products.list .card { align-items: flex-start; }
  .products.list .ph { width: 72px; }
  .products.list .body { grid-template-columns: 1fr; }
  .cline { grid-template-columns: 54px 1fr; }
  .cl-img { width: 54px; height: 54px; }
  .cl-qty { grid-column: 1 / -1; flex-direction: row; align-items: center; }
  .cl-sum { grid-column: 1 / -1; }
  .grid2, .grid2f { grid-template-columns: 1fr; }
  .cart-float { gap: 10px; padding: 10px 14px; font-size: 14px; }
  .cart-float #cfSum { display: none; }
}
@media (max-width: 380px) { .products.grid { grid-template-columns: 1fr; } }

@media print {
  .top, .subnav, .actions, .foot, .toast, form button, .save-bar { display: none !important; }
  body { background: #fff; }
  .table-wrap, .panel { box-shadow: none; }
}
