:root {
  --bg: #f5f6f8; --card: #fff; --text: #1d2330; --muted: #6b7280; --line: #e3e6eb;
  --accent: #4f46e5; --accent-soft: #eef0ff; --ok: #15803d; --ok-soft: #e7f6ec;
  --err: #b91c1c; --err-soft: #fdecec; --warn: #b45309; --warn-soft: #fff4e0;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 "Segoe UI", system-ui, sans-serif; background: var(--bg); color: var(--text); }
header { background: #1d2330; color: #fff; display: flex; align-items: center; gap: 16px; padding: 0 16px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 17px; padding: 14px 0; }
nav { display: flex; flex-wrap: wrap; align-items: stretch; flex: 1 1 auto; min-width: 0; }
nav a { color: #c9cdd6; text-decoration: none; padding: 15px 9px; border-bottom: 3px solid transparent; white-space: nowrap; font-size: 13.5px; }
nav a:hover { color: #fff; }
nav a.on { color: #fff; border-bottom-color: #818cf8; }
.badge { background: var(--accent); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 12px; }
.badge.warn { background: #d97706; }
main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 22px; margin: 4px 0 16px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
input, select, textarea, button { font: inherit; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  border: 1px solid #cfd4dc; border-radius: 6px; padding: 6px 9px; background: #fff; color: var(--text);
}
textarea { width: 100%; font-family: Consolas, monospace; font-size: 12px; }
input[type=number] { width: 70px; }
label { display: block; margin-bottom: 10px; }
label span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
label input:not([type=checkbox]), label select { width: 100%; }
.btn { display: inline-block; border: 1px solid #cfd4dc; background: #fff; color: var(--text); border-radius: 6px;
  padding: 6px 12px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.small { padding: 3px 8px; font-size: 12px; }
.btn.danger { color: var(--err); }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 10px; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.err { background: var(--err-soft); color: var(--err); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.stat { font-size: 26px; font-weight: 700; }
.best { background: var(--ok-soft); }
.best .price { color: var(--ok); font-weight: 700; }
.price { white-space: nowrap; }
.out { color: var(--muted); text-decoration: line-through; }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.err { background: var(--err-soft); color: var(--err); }
.hint { background: var(--warn-soft); color: var(--warn); border-radius: 6px; padding: 4px 8px; font-size: 12px; display: inline-flex; gap: 6px; align-items: center; }
.up { color: var(--err); } .down { color: var(--ok); }
details summary { cursor: pointer; font-weight: 600; }
.offer { display: flex; flex-direction: column; gap: 4px; }
.offer form { display: flex; gap: 4px; }
.cart-bar { position: sticky; bottom: 0; z-index: 10; display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px 10px 0 0; padding: 10px 16px;
  box-shadow: 0 -4px 14px rgba(0,0,0,.08); margin-top: 8px; }
.cart-bar-main b { font-size: 18px; }
.cart-bar-split { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); }
.cart-bar .btn { margin-left: auto; }
.offer:target { outline: 2px solid var(--ok); outline-offset: 4px; border-radius: 4px; animation: flashok 1.5s ease-out; }
@keyframes flashok { from { background: var(--ok-soft); } to { background: transparent; } }
.cart-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
.cart-side { position: sticky; top: 12px; padding: 12px; }
.cart-side h2 { font-size: 15px; margin: 4px 4px 10px; }
.draft { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 8px; text-decoration: none;
  color: var(--text); border: 1px solid transparent; margin-bottom: 4px; }
.draft:hover { background: var(--bg); }
.draft.on { background: var(--accent-soft); border-color: #c7cbff; }
.save-draft summary { list-style: none; display: inline-block; }
.save-draft summary::-webkit-details-marker { display: none; }
.save-draft[open] summary { opacity: .6; }
@media (max-width: 900px) { .cart-layout { grid-template-columns: 1fr; } .cart-side { position: static; order: -1; } }
.muted-badge { background: #cbd0d8; }
.tabs .badge { margin-left: 4px; }
.cart-picker select { min-width: 200px; }
nav a.nav-help { display: flex; flex-direction: column; align-items: center; line-height: 1.15; padding-top: 8px; padding-bottom: 6px; }
nav a.nav-help small { font-size: 11px; color: #9aa1ad; }
.help-contact { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.help-name { font-size: 18px; }
.help-phone { font-size: 28px; font-weight: 700; color: var(--accent); text-decoration: none; }
.help-phone:hover { text-decoration: underline; }
.user-box { margin-left: auto; display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.user-box a { color: #fff; text-decoration: none; display: flex; flex-direction: column; line-height: 1.15; text-align: right; }
.user-box small { color: #9aa1ad; font-size: 11px; }
.user-box .btn { background: transparent; color: #c9cdd6; border-color: #4b5262; }
.login-wrap { display: flex; justify-content: center; padding-top: 40px; }
.login-card { width: 100%; max-width: 380px; }
.app-footer { text-align: center; color: var(--muted); font-size: 12px; padding: 0 0 20px; }
.pager { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: center; margin: 12px 0; }
.prod { display: flex; gap: 10px; align-items: center; }
.thumb { width: 56px; height: 56px; object-fit: contain; flex: none; border-radius: 6px; background: #fff; border: 1px solid var(--line); }
.thumb.empty { background: var(--bg); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; font-weight: 600; }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 16px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px;
  display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--text); }
a.stat-card:hover { border-color: var(--accent); }
.stat-card b { font-size: 22px; line-height: 1.3; }
.stat-card.late { border-color: #f3b4b4; background: var(--err-soft); }
.stat-card.late b { color: var(--err); }
.stat-card.soon b { color: var(--warn); }
@media (max-width: 700px) { header { gap: 0; } nav a { padding: 10px 8px; } }
