.shop-app {
  color: #0f172a;
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 12px 32px;
  overflow-x: clip;
}

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: #f8fafc;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.shop-page-head {
  margin-bottom: 16px;
}

.shop-page-title {
  margin: 0 0 6px;
  font-size: clamp(1.35rem, 4vw, 1.875rem);
  font-weight: 700;
  color: #0f172a;
}

.shop-page-subtitle {
  margin: 0;
  color: #64748b;
  font-size: 14px;
}

.shop-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: end;
  margin-bottom: 20px;
  padding: 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
}

.shop-toolbar__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #475569;
  min-width: 0;
}

.shop-toolbar__client {
  grid-column: 1 / -1;
}

.shop-toolbar input[type="date"],
.shop-toolbar input[type="text"],
.shop-search {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font: inherit;
  background: #fff;
  box-sizing: border-box;
}

.shop-balance {
  grid-column: 1 / -1;
  padding: 10px 16px;
  border-radius: 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

@media (min-width: 640px) {
  .shop-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px;
  }

  .shop-toolbar__client {
    grid-column: auto;
    flex: 1 1 280px;
  }

  .shop-toolbar__client input {
    min-width: 280px;
  }

  .shop-balance {
    grid-column: auto;
    margin-left: auto;
    width: auto;
  }
}

.shop-balance.is-negative {
  background: #fef2f2;
  border-color: #fecaca;
}

.shop-balance__label {
  display: block;
  font-size: 12px;
  color: #64748b;
}

.shop-balance__value {
  font-size: clamp(1.1rem, 3vw, 1.35rem);
  color: #15803d;
}

.shop-balance.is-negative .shop-balance__value {
  color: #b91c1c;
}

.shop-tabs {
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 16px;
  overflow-x: auto;
}

.shop-tabs__list {
  display: flex;
  gap: 0;
  min-width: min-content;
}

.shop-tabs__tab {
  position: relative;
  padding: 10px 14px;
  margin-bottom: -1px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #64748b;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
}

@media (min-width: 640px) {
  .shop-tabs__tab {
    padding: 12px 20px;
    font-size: inherit;
  }
}

.shop-tabs__tab:hover {
  color: #334155;
}

.shop-tabs__tab.is-active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

.shop-panel[hidden] {
  display: none !important;
}

.shop-panel__toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
  margin-bottom: 12px;
}

@media (min-width: 640px) {
  .shop-panel__toolbar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
}

.shop-search--wide {
  width: 100%;
  padding: 10px 14px;
}

@media (min-width: 768px) {
  .shop-search--wide {
    flex: 1 1 480px;
    min-width: 320px;
    width: auto;
  }
}

.shop-btn {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  width: 100%;
}

@media (min-width: 640px) {
  .shop-btn {
    width: auto;
  }
}

.shop-btn--primary {
  background: #2563eb;
  color: #fff;
}

.shop-btn--primary:hover {
  background: #1d4ed8;
}

.shop-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.shop-muted {
  color: #64748b;
  font-size: 13px;
}

.shop-scroll-hint {
  display: none;
  margin: 0 0 6px;
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
}

@media (max-width: 767px) {
  .shop-scroll-hint {
    display: block;
  }
}

.shop-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.shop-table-wrap {
  overflow: visible;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.shop-table-wrap--scroll {
  max-height: 65vh;
  overflow: auto;
}

.shop-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.shop-table--settlements {
  min-width: 520px;
}

.shop-table--products {
  min-width: 680px;
}

.shop-table--settlements .shop-col-check,
.shop-table--settlements td.shop-col-check {
  width: 1%;
  max-width: 8.5rem;
  white-space: nowrap;
  font-size: 12px;
  padding-left: 8px;
  padding-right: 8px;
}

.shop-table--products .shop-article-inline {
  display: none;
}

@media (max-width: 767px) {
  .shop-table--products {
    min-width: 520px;
  }

  .shop-table--products .shop-col-article {
    display: none;
  }

  .shop-table--products .shop-article-inline {
    display: inline;
    color: #64748b;
    font-size: 12px;
  }
}

@media (min-width: 768px) {
  .shop-table {
    font-size: 14px;
  }

  .shop-table-wrap {
    border-radius: 16px;
  }
}

.shop-table th,
.shop-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 10px;
  vertical-align: top;
}

@media (min-width: 768px) {
  .shop-table th,
  .shop-table td {
    padding: 10px 12px;
  }
}

.shop-table thead th {
  position: sticky;
  top: 0;
  background: #0f172a;
  color: #fff;
  z-index: 1;
}

.shop-table tfoot th {
  background: #f8fafc;
  font-weight: 600;
}

.shop-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.shop-table tbody tr.is-clickable {
  cursor: pointer;
}

.shop-table tbody tr.is-clickable:hover,
.shop-table tbody tr.is-selected {
  background: #dbeafe;
}

.shop-table tbody tr.stock-low {
  color: #64748b;
}

.shop-table tbody tr.stock-out {
  color: #94a3b8;
}

.shop-table .num {
  text-align: right;
  white-space: nowrap;
}

.shop-table--products .shop-col-product {
  min-width: 140px;
}

/* Modal */
.shop-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
}

@media (min-width: 640px) {
  .shop-modal-overlay {
    align-items: center;
    padding: 16px;
  }
}

.shop-modal-overlay[hidden] {
  display: none !important;
}

.shop-modal {
  position: relative;
  width: 100%;
  max-width: 42rem;
  max-height: 92vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35);
}

@media (min-width: 640px) {
  .shop-modal {
    border-radius: 24px;
    max-height: 90vh;
  }
}

.shop-modal--wide {
  max-width: 56rem;
}

.shop-modal__header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 48px 16px 16px;
  background: #fff;
  border-bottom: 1px solid #f1f5f9;
}

.shop-modal__title {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: clamp(1rem, 3.5vw, 1.5rem);
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
  word-break: break-word;
}

@media (min-width: 640px) {
  .shop-modal__header {
    padding: 24px 56px 20px 24px;
    border-radius: 24px 24px 0 0;
  }
}

.shop-modal__close {
  flex-shrink: 0;
  padding: 8px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
}

.shop-modal__close:hover {
  color: #0f172a;
  background: #f1f5f9;
}

.shop-modal__close svg {
  width: 20px;
  height: 20px;
  display: block;
}

.shop-modal__body {
  padding: 16px;
}

@media (min-width: 640px) {
  .shop-modal__body {
    padding: 24px;
  }
}

.shop-modal__loading {
  padding: 24px 0;
  text-align: center;
  color: #64748b;
}

.shop-modal__table-wrap {
  overflow: visible;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}

.shop-modal__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.shop-modal__table--invoice {
  min-width: 520px;
}

.shop-modal__table th,
.shop-modal__table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
}

.shop-modal__table thead th {
  background: #f8fafc;
  font-weight: 600;
  text-align: left;
}

.shop-modal__table tfoot th {
  background: #f8fafc;
  font-weight: 600;
}

.shop-modal__table .num {
  text-align: right;
  white-space: nowrap;
}

/* Product card */
.shop-product-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
}

.shop-product-card__article {
  font-size: 14px;
  font-weight: 600;
  color: #334155;
  min-width: 0;
  word-break: break-word;
}

.shop-product-card__main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

@media (min-width: 560px) {
  .shop-product-card__main {
    grid-template-columns: 120px 1fr;
    gap: 20px;
  }
}

.shop-product-card__info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shop-product-price {
  margin-top: auto;
  padding-top: 8px;
  text-align: right;
  font-size: clamp(1.5rem, 5vw, 1.875rem);
  font-weight: 700;
  line-height: 1.1;
  color: #15803d;
  letter-spacing: -0.02em;
}
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

@media (min-width: 560px) {
  .shop-product-card__main {
    grid-template-columns: 120px 1fr;
    gap: 20px;
  }
}

.shop-product-card__media {
  min-width: 0;
}

.shop-product-photo {
  display: inline-block;
  padding: 0;
  border: none;
  background: transparent;
  cursor: zoom-in;
  border-radius: 12px;
  line-height: 0;
}

.shop-product-photo img {
  width: 120px;
  height: 120px;
  max-width: 100%;
  object-fit: contain;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  transition: box-shadow 0.2s;
}

@media (min-width: 560px) {
  .shop-product-photo img {
    width: 120px;
    height: 120px;
  }
}

.shop-product-photo:hover img {
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
}

.shop-product-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  margin: 0;
}

.shop-product-meta dt {
  margin: 0;
  color: #64748b;
  font-size: 13px;
}

.shop-product-meta dd {
  margin: 0;
  font-weight: 600;
  color: #0f172a;
  font-size: 14px;
  word-break: break-word;
}

.shop-product-card__extra {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shop-product-block__title {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.shop-product-text {
  padding: 10px 12px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  white-space: pre-wrap;
  font-size: 13px;
  color: #334155;
  word-break: break-word;
}

.shop-stock-badge {
  display: inline-block;
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.shop-stock-badge.is-unavailable {
  background: #f1f5f9;
  color: #64748b;
}

.shop-stock-badge.is-low {
  background: #fff7ed;
  color: #c2410c;
}

.shop-stock-badge.is-available {
  background: #f0fdf4;
  color: #15803d;
}

.shop-lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(6px);
  cursor: zoom-out;
}

.shop-lightbox[hidden] {
  display: none !important;
}

.shop-lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.shop-lightbox__close {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 10px;
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
}

.shop-lightbox__close svg {
  width: 24px;
  height: 24px;
  display: block;
}

.shop-toast {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 110;
  padding: 12px 16px;
  border-radius: 10px;
  background: #1e293b;
  color: #fff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.25);
}

@media (min-width: 640px) {
  .shop-toast {
    left: auto;
    right: 16px;
    bottom: 16px;
    max-width: 420px;
  }
}

.shop-toast.is-error {
  background: #b91c1c;
}

.shop-offline {
  position: sticky;
  bottom: 12px;
  z-index: 20;
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  font-size: 13px;
  text-align: center;
}

.shop-offline[hidden] {
  display: none;
}
