:root {
  --blue: #1b33d1;
  --blue-2: #2855ff;
  --ink: #0d1b2a;
  --slate: #5d697b;
  --muted: #eef2f7;
  --line: #d9dfeb;
  --paper: #ffffff;
  --soft: #f7f9fc;
  --dark: #050914;
  --green: #15803d;
  --amber: #b45309;
  --red: #dc2626;
  --shadow: 0 20px 60px rgba(13, 27, 42, 0.13);
  --radius: 8px;
  font-family: Montserrat, Inter, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--soft);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 22px;
  min-height: 74px;
  padding: 0 32px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 240px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 5px solid var(--blue);
  border-right-color: #a7afbf;
  border-radius: 50%;
}

.brand-mark::before,
.brand-mark::after,
.brand-mark span {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.brand-mark::before {
  inset: 8px;
  border: 3px solid var(--blue);
  border-left-color: transparent;
}

.brand-mark::after {
  width: 10px;
  height: 10px;
  top: 7px;
  right: -6px;
  background: var(--paper);
}

.brand-mark span {
  inset: 15px;
  background: #a7afbf;
}

.brand-copy {
  display: grid;
  line-height: 1.05;
}

.brand-copy strong {
  color: var(--blue);
  font-size: 24px;
  font-weight: 800;
}

.brand-copy small {
  color: var(--slate);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.main-nav {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.nav-link {
  min-height: 38px;
  padding: 0 14px;
  color: var(--slate);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 800;
}

.nav-link.active,
.nav-link:hover {
  color: var(--blue);
  background: #eef3ff;
  border-color: #d9e2ff;
}

.topbar-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.icon-btn,
.cart-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.icon-btn:hover,
.cart-button:hover {
  color: var(--blue);
  border-color: #b9c6ff;
}

.cart-button {
  position: relative;
}

.cart-button span {
  position: absolute;
  top: -7px;
  right: -7px;
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  color: var(--paper);
  background: var(--blue);
  border: 2px solid var(--paper);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

main {
  padding: 24px 32px 52px;
}

.hero-slider {
  position: relative;
  min-height: 450px;
  overflow: hidden;
  background: var(--dark);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  background-image:
    linear-gradient(90deg, rgba(5, 9, 20, 0.94) 0%, rgba(5, 9, 20, 0.64) 42%, rgba(5, 9, 20, 0.08) 100%),
    var(--bg);
  background-position: center;
  background-size: cover;
  transition: opacity 500ms ease;
}

.slide.active {
  opacity: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  display: grid;
  align-content: center;
  max-width: 820px;
  min-height: 450px;
  padding: 54px 60px 74px;
  color: var(--paper);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue-2);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.hero-content .eyebrow {
  color: #8ea5ff;
}

h1 {
  max-width: 760px;
  margin-bottom: 16px;
  font-size: clamp(36px, 4vw, 62px);
  line-height: 1.02;
}

h2 {
  margin-bottom: 0;
  font-size: 23px;
}

h3 {
  margin-bottom: 8px;
  font-size: 17px;
}

.hero-content p:not(.eyebrow) {
  max-width: 660px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 16px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.primary-btn,
.secondary-btn,
.text-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 900;
}

.primary-btn {
  color: var(--paper);
  background: var(--blue);
  box-shadow: 0 12px 26px rgba(27, 51, 209, 0.25);
}

.primary-btn:hover {
  background: var(--blue-2);
}

.secondary-btn {
  color: var(--ink);
  background: var(--paper);
  border-color: var(--line);
}

.secondary-btn:hover {
  color: var(--blue);
  border-color: #b9c6ff;
}

.text-btn {
  min-height: 34px;
  padding: 0 4px;
  color: var(--blue);
  background: transparent;
}

.compact {
  min-height: 38px;
  padding: 0 14px;
  font-size: 13px;
}

.full {
  width: 100%;
}

.slider-controls {
  position: absolute;
  right: 24px;
  bottom: 22px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
}

.slider-controls .icon-btn {
  color: var(--paper);
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.22);
}

.slide-dots {
  display: flex;
  gap: 7px;
}

.slide-dot {
  width: 9px;
  height: 9px;
  padding: 0;
  background: rgba(255, 255, 255, 0.42);
  border: 0;
  border-radius: 50%;
}

.slide-dot.active {
  background: var(--paper);
}

.search-deck {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  padding: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.api-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  min-height: 36px;
  padding: 0 12px;
  color: var(--slate);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 900;
}

.api-status span {
  width: 10px;
  height: 10px;
  background: var(--amber);
  border-radius: 50%;
}

.api-status.connected span {
  background: var(--green);
}

.api-status.demo span {
  background: var(--amber);
}

.api-status.error span {
  background: var(--red);
}

.search-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) repeat(3, minmax(130px, 0.7fr)) auto;
  gap: 12px;
  align-items: end;
}

.search-box {
  display: grid;
  gap: 7px;
}

.search-box span,
.field-label {
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.search-box input,
.text-input,
select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
}

.search-box input:focus,
.text-input:focus,
select:focus {
  border-color: #9fb2ff;
  box-shadow: 0 0 0 4px rgba(27, 51, 209, 0.09);
}

.workspace {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.category-panel,
.content-view {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.category-panel {
  position: sticky;
  top: 92px;
  max-height: calc(100vh - 112px);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
}

.panel-head,
.section-head,
.drawer-head,
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-head {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.category-tree {
  overflow: auto;
  padding: 10px;
}

.tree-node {
  margin-bottom: 4px;
}

.tree-button {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 7px 10px;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  text-align: left;
}

.tree-button:hover,
.tree-button.active {
  color: var(--blue);
  background: #eef3ff;
  border-color: #d9e2ff;
}

.tree-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  overflow: hidden;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.tree-icon img {
  width: 31px;
  height: 31px;
  object-fit: contain;
}

.tree-text {
  min-width: 0;
}

.tree-text strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-text small {
  display: block;
  color: var(--slate);
  font-size: 11px;
  font-weight: 800;
}

.tree-children {
  display: none;
  margin: 4px 0 8px 20px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.tree-node.open > .tree-children {
  display: block;
}

.tree-chevron {
  color: var(--slate);
  font-size: 15px;
  font-weight: 900;
}

.content-view {
  display: none;
  min-height: 650px;
  padding: 22px;
}

.active-view {
  display: block;
}

.section-head {
  margin-bottom: 18px;
}

.view-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--slate);
  font-size: 13px;
  font-weight: 800;
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}

.product-list {
  display: grid;
  gap: 10px;
}

.product-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 160px 150px 54px;
  gap: 14px;
  align-items: center;
  min-height: 104px;
  padding: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.product-row:hover {
  border-color: #b9c6ff;
  box-shadow: 0 10px 26px rgba(13, 27, 42, 0.08);
}

.product-thumb {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  overflow: hidden;
  background: linear-gradient(135deg, #f7f9fc 0%, #eef3ff 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.product-thumb img {
  width: 66px;
  height: 66px;
  object-fit: contain;
}

.mini-seal {
  width: 46px;
  height: 46px;
  border: 9px solid #050913;
  border-right-color: #244eff;
  border-radius: 50%;
}

.product-main {
  min-width: 0;
}

.sku {
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.product-main h3 {
  margin: 5px 0 8px;
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.product-meta span {
  padding: 5px 8px;
  color: var(--slate);
  background: var(--soft);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.stock-block,
.price-block {
  display: grid;
  gap: 4px;
}

.stock-block small,
.price-block small {
  color: var(--slate);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.stock-block strong {
  color: var(--green);
  font-size: 14px;
}

.stock-block.low strong {
  color: var(--amber);
}

.price-block strong {
  font-size: 18px;
}

.add-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--paper);
  background: var(--blue);
  border: 0;
  border-radius: var(--radius);
}

.add-btn:hover {
  background: var(--blue-2);
}

.empty {
  margin: 0;
  padding: 28px;
  color: var(--slate);
  background: var(--soft);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  font-weight: 800;
}

.order-list,
.support-layout {
  display: grid;
  gap: 12px;
}

.order-row,
.support-layout article {
  padding: 18px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.status {
  display: inline-flex;
  padding: 6px 10px;
  color: var(--green);
  background: #e9f8ef;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  justify-content: flex-end;
  background: rgba(13, 27, 42, 0.38);
}

.drawer.open {
  display: flex;
}

.drawer-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: min(460px, 100%);
  height: 100%;
  padding: 24px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.cart-items {
  display: grid;
  align-content: start;
  gap: 12px;
  overflow: auto;
  padding: 18px 0;
}

.cart-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 14px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.qty {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty button {
  width: 28px;
  height: 28px;
  color: var(--blue);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 900;
}

.cart-summary {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.cart-summary div {
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
  font-size: 18px;
}

.cart-summary p {
  margin: 12px 0 0;
  color: var(--slate);
  font-size: 12px;
  line-height: 1.45;
}

.account-dialog {
  width: min(430px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.account-dialog::backdrop {
  background: rgba(13, 27, 42, 0.42);
}

.account-dialog form {
  padding: 24px;
}

.field-label {
  display: block;
  margin: 18px 0 8px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 90;
  transform: translate(-50%, 18px);
  opacity: 0;
  min-width: min(440px, calc(100% - 32px));
  padding: 13px 16px;
  color: var(--paper);
  background: var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: 180ms ease;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 1180px) {
  .search-grid,
  .workspace {
    grid-template-columns: 1fr;
  }

  .category-panel {
    position: static;
    max-height: 520px;
  }

  .product-row {
    grid-template-columns: 70px minmax(0, 1fr) 130px;
  }

  .price-block,
  .add-btn {
    grid-column: 2 / -1;
  }
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: 1fr auto;
    padding: 0 16px;
  }

  .brand {
    min-width: 0;
  }

  .brand-copy strong {
    font-size: 20px;
  }

  .main-nav {
    grid-column: 1 / -1;
    order: 3;
    justify-content: flex-start;
    overflow: auto;
    padding-bottom: 12px;
  }

  main {
    padding: 16px;
  }

  .hero-slider,
  .hero-content {
    min-height: 520px;
  }

  .hero-content {
    padding: 34px 22px 90px;
  }

  .slider-controls {
    left: 20px;
    right: auto;
  }

  .search-deck,
  .content-view {
    padding: 16px;
  }

  .section-head,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .view-tools {
    width: 100%;
    justify-content: flex-start;
  }

  .product-row {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .stock-block,
  .price-block,
  .add-btn {
    grid-column: 2 / -1;
  }
}
