:root {
  --navy: #112a46;
  --navy-2: #1c3d61;
  --blue: #1b66b2;
  --pale: #edf5fb;
  --ink: #172334;
  --muted: #657487;
  --line: #d9e2ea;
  --surface: #ffffff;
  --bg: #f3f6f8;
  --good: #147a4b;
  --warn: #a05a00;
  --bad: #b32828;
  --shadow: 0 12px 34px rgba(17, 42, 70, .09);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.topbar { min-height: 78px; padding: 14px max(20px, env(safe-area-inset-left)); background: var(--navy); color: white; display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 42px; height: 42px; border-radius: 12px; background: #fff; color: var(--navy); display: grid; place-items: center; font-weight: 850; font-size: 23px; }
.topbar h1 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.topbar p { margin: 2px 0 0; color: #bfd2e4; font-size: 13px; }
.connection { margin-left: auto; padding: 5px 9px; border: 1px solid #557493; border-radius: 99px; color: #cfe0ef; font-size: 11px; font-weight: 750; letter-spacing: .08em; }
main { width: min(1080px, 100%); margin: 0 auto; padding: 24px 18px 48px; }
.search-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 25px; box-shadow: var(--shadow); }
.eyebrow { color: var(--blue); font-size: 11px; font-weight: 850; letter-spacing: .12em; }
h2 { margin: 7px 0 0; font-size: clamp(24px, 4vw, 34px); letter-spacing: -.035em; }
.intro { color: var(--muted); margin: 7px 0 20px; }
.search-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.search-box { min-height: 52px; border: 1.5px solid #afbdca; border-radius: 12px; background: #fff; display: flex; align-items: center; padding: 0 10px 0 14px; transition: .18s ease; }
.search-box:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(27, 102, 178, .12); }
.search-icon { font-size: 24px; color: var(--muted); transform: rotate(-20deg); }
.search-box input { border: 0; outline: 0; width: 100%; min-width: 0; padding: 0 10px; color: var(--ink); background: transparent; }
.clear-button { border: 0; background: #eef2f5; color: var(--muted); border-radius: 50%; width: 30px; height: 30px; cursor: pointer; font-size: 20px; line-height: 1; }
.primary-button { min-height: 52px; border: 0; border-radius: 12px; background: var(--blue); color: white; padding: 0 25px; font-weight: 800; cursor: pointer; box-shadow: 0 8px 18px rgba(27, 102, 178, .2); }
.primary-button:hover { background: #125695; }
.filters { margin-top: 16px; display: flex; gap: 22px; align-items: end; flex-wrap: wrap; }
.filters label > span:first-child { display: block; color: var(--muted); font-size: 12px; font-weight: 700; margin-bottom: 6px; }
select { min-width: 240px; height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 0 36px 0 11px; background: white; color: var(--ink); }
.toggle-row { display: flex; align-items: center; gap: 9px; min-height: 42px; cursor: pointer; color: var(--ink); font-size: 14px; }
.toggle-row input { position: absolute; opacity: 0; }
.toggle { width: 39px; height: 23px; border-radius: 99px; background: #b9c4cd; position: relative; transition: .18s ease; }
.toggle::after { content: ""; position: absolute; width: 17px; height: 17px; border-radius: 50%; background: white; top: 3px; left: 3px; transition: .18s ease; box-shadow: 0 1px 5px #0003; }
.toggle-row input:checked + .toggle { background: var(--blue); }
.toggle-row input:checked + .toggle::after { transform: translateX(16px); }
.results-section { margin-top: 28px; }
.results-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 13px; }
.results-heading h2 { font-size: 23px; }
.result-count { min-width: 38px; height: 30px; padding: 0 10px; border-radius: 99px; background: var(--navy); color: white; display: grid; place-items: center; font-size: 13px; font-weight: 800; }
.empty-state, .loading-state, .error-state { border: 1px dashed #bbc8d3; border-radius: 16px; padding: 42px 20px; text-align: center; color: var(--muted); background: rgba(255,255,255,.55); }
.empty-state h3 { color: var(--ink); margin: 8px 0 5px; }
.empty-state p { margin: 0; }
.empty-symbol { font-size: 37px; transform: rotate(-20deg); color: #8295a7; }
.loading-state { display: flex; align-items: center; justify-content: center; gap: 12px; }
.spinner { width: 22px; height: 22px; border: 3px solid #cbd8e3; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-state { border-color: #e8bcbc; background: #fff3f3; color: var(--bad); }
.results-list { display: grid; gap: 12px; }
.product-card { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; padding: 17px; box-shadow: 0 5px 18px rgba(17,42,70,.05); }
.product-head { display: grid; grid-template-columns: 1fr auto; gap: 14px; }
.code { color: var(--blue); font-weight: 850; font-size: 13px; letter-spacing: .04em; }
.product-title { font-size: 16px; line-height: 1.35; font-weight: 770; margin: 4px 0 7px; }
.meta { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { background: var(--pale); color: var(--navy-2); border-radius: 99px; padding: 4px 8px; font-size: 11px; font-weight: 700; }
.stock-summary { text-align: right; min-width: 96px; }
.stock-number { display: block; font-size: 25px; font-weight: 850; color: var(--good); line-height: 1; }
.stock-number.zero { color: var(--muted); }
.stock-number.negative { color: var(--bad); }
.stock-label { font-size: 11px; color: var(--muted); }
.price-row { display: flex; gap: 22px; padding: 13px 0 0; margin-top: 13px; border-top: 1px solid #edf1f4; }
.price-row span { color: var(--muted); font-size: 11px; display: block; }
.price-row strong { font-size: 17px; }
.warehouse-list { margin: 13px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.warehouse-list li { background: #f7f9fb; border-radius: 9px; padding: 8px 10px; display: grid; grid-template-columns: 1fr repeat(3, auto); gap: 12px; align-items: center; font-size: 12px; }
.warehouse-list strong { color: var(--ink); }
.warehouse-list small { color: var(--muted); }
footer { text-align: center; color: var(--muted); font-size: 11px; padding: 0 18px 30px; }
@media (max-width: 640px) {
  main { padding: 16px 12px 38px; }
  .search-panel { padding: 20px 15px; border-radius: 15px; }
  .search-form { grid-template-columns: 1fr; }
  .primary-button { width: 100%; }
  .filters { display: grid; gap: 12px; }
  select { width: 100%; min-width: 0; }
  .product-head { grid-template-columns: 1fr; }
  .stock-summary { text-align: left; display: flex; align-items: baseline; gap: 7px; }
  .warehouse-list li { grid-template-columns: 1fr auto; }
  .warehouse-list .detail-secondary { display: none; }
}
