:root {
  --bg: #f1f5f9;
  --card: #fff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --gradient: linear-gradient(135deg, #2563eb, #4f46e5);
  --danger: #b91c1c;
  --ok: #15803d;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
.page { max-width: 1200px; margin: 0 auto; padding: 16px 16px 40px; }
.top {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-bottom: 16px; padding: 12px 16px;
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.badge {
  width: 40px; height: 40px; border-radius: 12px; background: var(--gradient);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-family: Outfit, sans-serif; font-weight: 800; font-size: 18px;
}
.brand h1 { font-family: Outfit, sans-serif; font-size: 18px; font-weight: 700; }
.brand p { font-size: 12px; color: var(--muted); }
.nav { display: flex; gap: 6px; }
.nav-link {
  padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 600;
  color: var(--muted); border: 1px solid transparent;
}
.nav-link.active, .nav-link:hover {
  background: var(--accent-soft); color: #1d4ed8; border-color: #bfdbfe;
}
.top-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.user-pill {
  font-size: 13px; color: var(--muted); max-width: 220px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 10px; padding: 10px 14px;
  font: inherit; font-weight: 600; color: #fff; background: var(--gradient); cursor: pointer;
}
.btn-ghost {
  background: #fff; color: var(--text); border: 1px solid var(--border);
}
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow); padding: 16px;
}
.hero-card { padding: 28px; margin-bottom: 16px; }
.hero-card h2 {
  font-family: Outfit, sans-serif; font-size: clamp(26px, 4vw, 36px);
  font-weight: 800; margin: 10px 0 10px;
}
.lead { color: var(--muted); line-height: 1.5; max-width: 640px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent-soft); color: #1d4ed8; border: 1px solid #bfdbfe;
  border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 600;
}
.pill-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
@media (max-width: 800px) { .grid-3 { grid-template-columns: 1fr; } }
.feature {
  background: #f8fafc; border: 1px solid var(--border); border-radius: 12px; padding: 14px;
}
.feature strong { display: block; margin-bottom: 4px; }
.feature span { color: var(--muted); font-size: 13px; line-height: 1.4; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.field input {
  width: 100%; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font: inherit; background: #f8fafc;
}
.error {
  background: #fef2f2; border: 1px solid #fecaca; color: var(--danger);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px;
}
.muted { color: var(--muted); font-size: 13px; }
.footer {
  margin-top: 18px; display: flex; justify-content: space-between; gap: 10px;
  flex-wrap: wrap; color: var(--muted); font-size: 13px;
}

/* Catalog: L1 → hover mega → list */
.catalog-page .page { max-width: 1280px; }
.catalog-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 12px;
  min-height: 70vh;
  align-items: start;
}
@media (max-width: 900px) {
  .catalog-shell { grid-template-columns: 1fr; }
}
.l1-panel {
  background: #e8edf3; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--border); position: sticky; top: 12px;
}
.l1-head {
  padding: 12px 14px; font-weight: 800; font-size: 14px;
  background: #dbe3ee; border-bottom: 1px solid var(--border);
}
.l1-list { max-height: min(78vh, 820px); overflow: auto; }
.l1-item {
  display: flex; flex-direction: column; gap: 2px;
  width: 100%; text-align: left; border: 0; background: transparent;
  padding: 11px 14px; font: inherit; cursor: pointer; color: var(--text);
  border-bottom: 1px solid rgba(15,23,42,0.06);
}
.l1-name { font-weight: 700; font-size: 14px; }
.l1-cap { font-size: 11px; color: var(--muted); line-height: 1.3; }
.l1-item:hover, .l1-item.active {
  background: #fff; color: #1d4ed8;
}
.l1-item.active .l1-cap { color: #64748b; }
.mega, .start-panel, .list-panel {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px; box-shadow: var(--shadow); min-height: 320px;
}
.start-panel h2 {
  font-family: Outfit, sans-serif; font-size: 26px; margin-bottom: 8px;
}
.mega-title {
  font-family: Outfit, sans-serif; font-size: 20px; font-weight: 800; margin-bottom: 14px;
}
.mega-cols {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 22px;
}
@media (max-width: 900px) { .mega-cols { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .mega-cols { grid-template-columns: 1fr; } }
.mega-brand h4 {
  font-size: 12px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.03em; margin-bottom: 6px; color: #0f172a;
}
.mega-brand button {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 3px 0; font: inherit; font-size: 13px; color: #334155; cursor: pointer;
}
.mega-brand button:hover { color: var(--accent); }
.list-layout {
  display: grid; grid-template-columns: 220px 1fr; gap: 16px;
}
@media (max-width: 800px) { .list-layout { grid-template-columns: 1fr; } }
.l3-side-title {
  font-size: 12px; font-weight: 800; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px;
}
.l3-side-item {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 7px 8px; border-radius: 8px; font: inherit; font-size: 13px;
  color: #334155; cursor: pointer; margin-bottom: 2px;
}
.l3-side-item:hover { background: #f1f5f9; }
.l3-side-item.active {
  background: #fff1f2; color: #be123c; font-weight: 700;
  box-shadow: inset 3px 0 0 #e11d48;
}
.list-title {
  font-family: Outfit, sans-serif; font-size: 22px; font-weight: 800;
  margin: 0 0 12px;
}
.prod-list { display: flex; flex-direction: column; gap: 0; }
.prod-row {
  display: grid; grid-template-columns: 1fr 180px; gap: 12px;
  padding: 14px 4px; border-bottom: 1px solid var(--border); align-items: start;
}
@media (max-width: 700px) {
  .prod-row { grid-template-columns: 1fr; }
}
.prod-name { font-size: 14px; font-weight: 600; line-height: 1.35; margin-bottom: 4px; }
.prod-code { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.prod-stock { font-size: 13px; line-height: 1.45; }
.prod-price { text-align: right; font-size: 16px; font-weight: 700; }
.price-ask { font-size: 13px; font-weight: 600; color: var(--muted); }
.price-val { font-family: Outfit, sans-serif; }
.toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 12px;
}
.toolbar .grow { flex: 1; min-width: 180px; }
.toolbar label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.toolbar input, .toolbar select {
  width: 100%; border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 11px; font: inherit; background: #f8fafc;
}
.ok { color: var(--ok); font-weight: 700; }
.bad { color: var(--danger); font-weight: 700; }
.empty { text-align: center; color: var(--muted); padding: 28px; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.hidden { display: none !important; }
.totals {
  margin-top: 12px; padding: 12px 14px; border-radius: 12px;
  background: var(--accent-soft); border: 1px solid #bfdbfe;
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.totals strong { font-family: Outfit, sans-serif; font-size: 18px; }
.row-unpaid td { background: #fef2f2; }
