:root {
  color-scheme: light;
  --bg: #f4f8f7;
  --panel: #ffffff;
  --ink: #10201f;
  --muted: #5d6f6b;
  --line: #d5dfdc;
  --primary: #0f7668;
  --primary-strong: #0b5b50;
  --danger: #b9332b;
  --warn: #94640c;
  --good: #1f7a43;
  --shadow: 0 14px 38px rgba(15, 30, 35, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
}

.login-card {
  width: min(520px, 100%);
  display: grid;
  gap: 16px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: #f3c432;
  color: #021a1a;
  font-weight: 900;
  font-size: 24px;
}

.brand-row strong,
.brand-row span {
  display: block;
  min-width: 0;
}

.brand-row strong {
  font-size: 25px;
  line-height: 1.2;
}

.brand-row span {
  color: var(--muted);
}

.lang-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf3f1;
}

.lang-switch.compact {
  width: 170px;
}

.lang-btn {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.lang-btn.active {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 2px 10px rgba(15, 30, 35, 0.08);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 13px;
  background: #ffffff;
  color: var(--ink);
}

textarea {
  min-height: 90px;
  resize: vertical;
}

.password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 10px;
}

.btn {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 16px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
}

.btn.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
}

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

.btn.ghost {
  background: #ffffff;
}

.btn.full {
  width: 100%;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.error {
  margin: 0;
  color: var(--danger);
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.status-bar {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #b9dccf;
  border-radius: 8px;
  background: #ecf9f3;
  color: var(--primary-strong);
}

.status-bar.error {
  border-color: #f3bab5;
  background: #fff0ef;
  color: var(--danger);
}

.summary-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.summary-row > div,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.summary-row > div {
  min-height: 96px;
  padding: 16px;
}

.summary-row span,
.summary-row strong {
  display: block;
}

.summary-row span {
  color: var(--muted);
}

.summary-row strong {
  margin-top: 12px;
  font-size: 26px;
  line-height: 1.1;
}

.shop-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.34fr);
  gap: 14px;
  align-items: start;
}

.panel {
  min-width: 0;
  padding: 16px;
}

.panel-head {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
}

h1 {
  font-size: 26px;
}

h2 {
  font-size: 22px;
}

h3 {
  font-size: 18px;
}

.badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  background: #e8f5f1;
  color: var(--primary);
  font-weight: 800;
}

.filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 240px) 110px;
  gap: 10px;
  margin-bottom: 14px;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.product-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.product-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f2f5f4;
  color: var(--muted);
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-card strong,
.product-card span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.product-name {
  min-height: 46px;
  font-weight: 800;
}

.product-meta {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.product-price {
  font-size: 22px;
  font-weight: 900;
}

.qty-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 8px;
}

.qty-row input {
  min-height: 46px;
}

.cart-panel {
  position: sticky;
  top: 12px;
}

.cart-list,
.record-list {
  display: grid;
  gap: 8px;
}

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

.cart-item,
.record-item {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.cart-item-top,
.record-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.cart-item strong,
.record-item strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.cart-item small,
.record-item small {
  color: var(--muted);
}

.cart-item-controls {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) 84px;
  gap: 8px;
  align-items: center;
}

.cart-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0;
  padding: 14px;
  border-radius: 8px;
  background: #e9f7f3;
}

.cart-total span {
  color: var(--muted);
}

.cart-total strong {
  font-size: 28px;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.records-panel {
  margin-top: 14px;
}

.records-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.record-status {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  padding: 0 8px;
  background: #edf2f7;
  color: #355066;
  font-size: 13px;
}

@media (max-width: 1100px) {
  .shop-layout,
  .records-grid {
    grid-template-columns: 1fr;
  }

  .cart-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 14px;
  }

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

  .header-actions,
  .lang-switch.compact {
    width: 100%;
  }

  .summary-row,
  .filter-row {
    grid-template-columns: 1fr;
  }

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