:root {
  --bg: #f4f8ff;
  --card: #ffffff;
  --ink: #14213d;
  --muted: #5f6d84;
  --line: #deebff;
  --primary: #1d6ae8;
  --primary-2: #114bb0;
  --primary-soft: #edf4ff;
  --ok: #128046;
  --error: #c63a3a;
  --shadow-soft: 0 14px 34px rgba(17, 40, 78, 0.09);
  --radius-lg: 18px;
  --transition-soft: 180ms ease;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

select,
.select {
  width: 100%;
  border: 1px solid #cedaf0;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 0.7rem;
  font: inherit;
  background: #fff;
}

.upload-box {
  margin-top: 1rem;
  padding: 0.9rem;
  border: 1px dashed #aac3eb;
  border-radius: 12px;
  background: #f8fbff;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 15% 10%, #e6f0ff 0, #f7f9ff 45%, #f2f6ff 100%);
}

.container {
  width: min(1100px, 92%);
  margin-inline: auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
}

.brand {
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary-2);
}

.menu {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.menu a {
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
}

.cart-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.cart-count {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 1.2rem;
  height: 1.2rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
}

.hero {
  padding: 3.5rem 0;
}

.hero-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1.2fr 1fr;
  align-items: center;
}

.pill {
  display: inline-flex;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: #dce9ff;
  font-weight: 700;
  color: #104aad;
}

h1,
h2,
h3 {
  margin: 0;
}

.hero h1 {
  margin-top: 1rem;
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1.15;
}

.subtitle {
  margin-top: 1rem;
  max-width: 50ch;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.2rem;
}

.btn {
  border: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
  color: #fff;
  font-weight: 700;
  padding: 0.78rem 1.1rem;
  text-decoration: none;
  cursor: pointer;
}

.btn-outline {
  background: #fff;
  color: var(--primary-2);
  border: 1px solid #aec9f8;
}

.btn-small {
  padding: 0.5rem 0.7rem;
  font-size: 0.9rem;
}

.hero-phone {
  position: relative;
  min-height: 300px;
  display: grid;
  place-items: center;
}

.phone-shape {
  width: min(320px, 85%);
  height: 320px;
  border-radius: 28px;
  background: linear-gradient(155deg, #0e4ab5, #5ca3ff);
  transform: rotate(-8deg);
  box-shadow: 0 20px 60px rgba(28, 81, 170, 0.3);
}

.phone-card {
  position: absolute;
  width: min(260px, 75%);
  background: #fff;
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 18px 35px rgba(20, 30, 60, 0.25);
}

.phone-card h3 {
  margin-bottom: 0.4rem;
}

.flow,
.catalog,
.admin {
  padding: 2rem 0 3rem;
}

.login-page {
  min-height: calc(100vh - 76px);
  display: grid;
  place-items: center;
  padding: 2rem 1rem 4rem;
  background: linear-gradient(135deg, #eef5ff 0%, #f8fbff 52%, #fff8ee 100%);
}

.login-panel {
  width: min(100%, 430px);
  padding: 2rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(20, 30, 60, 0.12);
}

.login-panel h1 {
  margin-bottom: 0.5rem;
}

.login-intro {
  margin-bottom: 1.5rem;
  color: var(--muted);
}

.eyebrow {
  margin-bottom: 0.5rem;
  color: var(--primary-2);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.flow-grid {
  margin-top: 1rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.flow article {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-heading h1 {
  margin-bottom: 0.5rem;
}

.price-disclaimer {
  margin: 0;
  padding: 0.75rem 1rem;
  border: 1px solid #f0c36d;
  border-radius: 8px;
  background: #fff8e6;
  color: #684b12;
  font-size: 0.9rem;
}

.section-title a {
  text-decoration: none;
  color: var(--primary-2);
  font-weight: 700;
}

.products-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.product-card {
  transition: opacity 0.18s ease, transform 0.18s ease, filter 0.18s ease;
}

.product-card.is-hidden {
  opacity: 0;
  transform: scale(0.98);
  filter: blur(1px);
  pointer-events: none;
}

.product-search-shell {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 1rem;
  max-width: 420px;
}

.brand-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 0.75rem;
  margin: 1.2rem 0 1.8rem;
}

.brand-option {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 42px;
  padding: 0.4rem 0.7rem 0.4rem 0.45rem;
  border: 2px solid rgba(17, 79, 170, 0.75);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}

.brand-option:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(16, 33, 60, 0.08);
}

.brand-option.is-active {
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
  border-color: #0d4bb3;
  color: #fff;
  box-shadow: 0 8px 18px rgba(29, 90, 205, 0.18);
}

.brand-icon {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(180deg, #edf5ff, #dfeeff);
  border: 1px solid rgba(17, 79, 170, 0.4);
  color: var(--primary-2);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.brand-option.is-active .brand-icon {
  background: #fff;
  border-color: rgba(255, 255, 255, 0.35);
  color: var(--primary-2);
}

.brand-name {
  white-space: nowrap;
  font-size: 0.98rem;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.38rem;
  border-radius: 999px;
  background: #edf4ff;
  border: 1px solid rgba(17, 79, 170, 0.35);
  color: var(--primary-2);
  font-size: 0.72rem;
  font-weight: 900;
}

.brand-option.is-active .brand-badge {
  background: #fff;
  border-color: rgba(255, 255, 255, 0.4);
  color: var(--primary-2);
}

.product-search-label {
  font-weight: 700;
  color: var(--muted);
}

.order-layout {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 1rem;
  align-items: start;
}

.products-grid-order {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.product-card-order .product-actions {
  display: flex;
  gap: 0.45rem;
  padding: 0 0.8rem 0.8rem;
}

.product-actions input {
  max-width: 85px;
}

.product-qty-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  max-width: 150px;
  padding: 0.15rem 0.35rem;
  border: 1px solid rgba(17, 52, 107, 0.12);
  border-radius: 999px;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.product-qty-control input {
  width: 2.2rem;
  min-width: 2.2rem;
  max-width: 2.2rem;
  padding: 0;
  margin: 0;
  text-align: center;
  border: 0;
  background: transparent;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--ink);
  appearance: textfield;
  -moz-appearance: textfield;
}

.product-qty-control input::-webkit-outer-spin-button,
.product-qty-control input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.product-qty-control .qty-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.checkout-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  position: sticky;
  top: 86px;
}

.cart-layout {
  grid-template-columns: 1fr 1fr;
}

.cart-items {
  margin: 0.8rem 0;
  padding-left: 0;
  display: grid;
  gap: 0.75rem;
  list-style: none;
}

.cart-item-card {
  padding: 1rem 1rem 0.85rem;
  border: 1px solid rgba(33, 111, 240, 0.12);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f5f9ff 100%);
  box-shadow: 0 10px 24px rgba(16, 33, 60, 0.05);
}

.cart-item-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.8rem;
  margin-bottom: 0.9rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid rgba(17, 52, 107, 0.08);
}

.cart-item-info {
  display: grid;
  gap: 0.2rem;
}

.cart-item-info strong {
  font-size: 1rem;
  line-height: 1.3;
}

.cart-item-info small {
  color: var(--muted);
  font-size: 0.76rem;
}

.cart-item-total {
  font-weight: 800;
  color: var(--primary-2);
  white-space: nowrap;
  font-size: 1rem;
}

.cart-item-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.qty-control {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.4rem;
  border: 1px solid rgba(17, 52, 107, 0.12);
  border-radius: 999px;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.qty-btn {
  border: 0;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
  color: #fff;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
  box-shadow: 0 6px 12px rgba(35, 92, 214, 0.18);
}

.qty-btn:hover {
  transform: translateY(-1px);
}

.qty-value {
  min-width: 1.3rem;
  text-align: center;
  font-weight: 800;
  color: var(--ink);
}

.cart-remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid rgba(191, 45, 45, 0.2);
  border-radius: 10px;
  background: #fff5f5;
  color: var(--error);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 120px;
}

.cart-remove-btn:hover {
  background: #ffe9e9;
  transform: translateY(-1px);
}

.cart-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1rem;
  box-shadow: 0 16px 35px rgba(16, 33, 60, 0.08);
}

.cart-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.2rem;
}

.cart-chip {
  display: inline-flex;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: #eaf3ff;
  color: var(--primary-2);
  font-weight: 800;
  font-size: 0.85rem;
}

.cart-summary {
  margin-top: 0.9rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
}

.cart-total {
  margin: 0.2rem 0 0.8rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
}

.cart-feedback {
  min-height: 1.5rem;
  margin: 0.75rem 0 0;
  color: var(--primary-2);
  font-weight: 700;
}

.cart-feedback.error-text {
  color: var(--error);
}

.empty-cart {
  padding: 1rem;
  border: 1px dashed var(--line);
  border-radius: 14px;
  text-align: center;
  color: var(--muted);
}

.compact {
  gap: 0.55rem;
}

.checkout-feedback {
  min-height: 22px;
  margin-top: 0.7rem;
  font-weight: 700;
  color: var(--ok);
}

.error-text {
  color: var(--error);
}

.product-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
}

.product-card img {
  width: min(100%, 220px);
  height: 220px;
  max-width: 220px;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  object-position: center;
  display: block;
  margin: 0 auto;
  border-radius: 12px;
  background: linear-gradient(180deg, #f5f8ff 0%, #edf4ff 100%);
  padding: 0.35rem;
}

.lazy-product-image {
  opacity: 0.82;
  transition: opacity 0.2s ease, transform 0.2s ease;
  will-change: opacity;
}

.lazy-product-image.is-loaded {
  opacity: 1;
}

.product-card div {
  padding: 0.8rem;
}

.product-card h3 {
  font-size: 1rem;
  margin-bottom: 0.4rem;
}

.product-card p {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.product-card span {
  display: block;
  padding: 0.8rem;
  border-top: 1px solid var(--line);
  font-weight: 700;
}

.price-block {
  display: grid;
  gap: 0.2rem;
  justify-items: center;
}

.price-old {
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: line-through;
}

.price-block strong {
  font-size: 1.05rem;
}

.discount-pill {
  display: inline-flex;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: #dff8eb;
  color: var(--ok);
  font-size: 0.8rem;
  font-weight: 800;
}

@media (max-width: 768px) {
  .products-grid {
    grid-template-columns: 1fr;
    gap: 0.95rem;
  }

  .product-card {
    align-items: stretch;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(16, 33, 60, 0.08);
  }

  .product-card img {
    width: 100%;
    max-width: none;
    height: min(52vw, 260px);
    min-height: 170px;
    object-fit: contain;
    object-position: center;
    border-radius: 0;
    margin: 0;
    padding: 0.75rem 0.75rem 0;
    background: linear-gradient(180deg, #f7faff 0%, #eef5ff 100%);
  }

  .product-card > div,
  .product-card .product-actions,
  .product-card span {
    padding-left: 0.95rem;
    padding-right: 0.95rem;
  }

  .product-card .product-actions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding-bottom: 0.95rem;
  }

  .product-card .product-actions input {
    max-width: 100%;
  }

  .product-card .btn-small {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .product-card img {
    height: min(54vw, 220px);
    min-height: 150px;
  }
}

.page {
  min-height: calc(100vh - 80px);
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
}

.divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1.2rem 0;
}

.page-actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.form-grid {
  margin-top: 1rem;
  display: grid;
  gap: 0.8rem;
}

.filters-grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.status-label {
  font-weight: 700;
  color: var(--muted);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 800;
  border: 1px solid transparent;
}

.status-online {
  color: #0f8a42;
  background: #d8f4e2;
  border-color: #94dcb2;
}

.status-offline {
  color: #b33b1f;
  background: #ffe7d7;
  border-color: #ffc8ae;
}

.image-input-group {
  display: grid;
  gap: 0.8rem;
}

.muted-text {
  color: var(--muted);
  font-size: 0.85rem;
}

label {
  display: grid;
  gap: 0.4rem;
  font-weight: 700;
}

input {
  width: 100%;
  border: 1px solid #cedaf0;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 0.7rem;
  font: inherit;
}

textarea {
  width: 100%;
  border: 1px solid #cedaf0;
  border-radius: 8px;
  min-height: 160px;
  padding: 0.7rem;
  font: inherit;
  resize: vertical;
}

.readonly-input {
  background: #f6f9ff;
  color: var(--muted);
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checkbox input {
  width: 18px;
  min-height: 18px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 0.6rem;
  border-bottom: 1px solid var(--line);
}

.stock-form {
  display: flex;
  gap: 0.4rem;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.actions-cell {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.inline-form {
  margin: 0;
}

.stacked-cell {
  display: grid;
  gap: 0.25rem;
}

.cell-muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.order-items-preview {
  max-width: 280px;
  white-space: normal;
}

.order-items-editor {
  display: grid;
  gap: 0.8rem;
}

.order-items-header {
  margin-bottom: 0;
}

.order-items-list {
  display: grid;
  gap: 0.8rem;
}

.order-item-row {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(72px, 0.7fr) minmax(120px, 1fr) auto;
  gap: 0.75rem;
  align-items: end;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbff;
}

.order-item-row label {
  min-width: 0;
}

.order-item-row input {
  width: 100%;
  min-width: 0;
}

.order-item-actions {
  display: flex;
  justify-content: flex-end;
}

.inactive-row {
  opacity: 0.65;
}

.stock-form input {
  max-width: 95px;
}

.alert {
  margin-top: 1rem;
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  font-weight: 700;
}

.success {
  background: #d8f4e2;
  color: var(--ok);
}

.error {
  background: #ffe0e0;
  color: var(--error);
}

@media (max-width: 960px) {
  .hero-grid,
  .admin-grid,
  .order-layout {
    grid-template-columns: 1fr;
  }

  .filters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-item-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .products-grid-order {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .flow-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .menu {
    gap: 0.5rem;
    font-size: 0.9rem;
  }

  .hero {
    padding: 1.8rem 0;
  }

  .products-grid {
    grid-template-columns: 1fr;
  }

  .products-grid-order {
    grid-template-columns: 1fr;
  }

  .checkout-card {
    position: static;
  }

  .topbar-inner {
    min-height: 62px;
  }

  .filters-grid {
    grid-template-columns: 1fr;
  }

  .order-item-row {
    grid-template-columns: 1fr;
  }
}
