:root {
  color-scheme: light;
  --bg: #fbfbf8;
  --panel: #ffffff;
  --ink: #171717;
  --muted: #6f6b63;
  --line: #e7e2d9;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #b42318;
  --ok: #067647;
  --image: #f5f5f0;
}

* {
  box-sizing: border-box;
}

html {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

body {
  margin: 0;
  min-height: 100vh;
  font-size: 17px;
  line-height: 1.45;
}

a {
  color: inherit;
  text-decoration: none;
}

.page {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 22px 18px 112px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0;
}

.tagline {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.section-title {
  margin: 28px 0 14px;
  font-size: 22px;
}

.grid {
  display: grid;
  gap: 14px;
}

.product-filter {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 -18px 14px;
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(251, 251, 248, 0.96);
  backdrop-filter: blur(8px);
}

.filter-tabs,
.filter-subtabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filter-tabs::-webkit-scrollbar,
.filter-subtabs::-webkit-scrollbar {
  display: none;
}

.filter-subtabs {
  margin-top: 8px;
}

.filter-tab,
.filter-chip {
  flex: 0 0 auto;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 0 14px;
  font: inherit;
  font-size: 15px;
  font-weight: 850;
  cursor: pointer;
}

.filter-tab.active,
.filter-chip.active {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.empty-state {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
}

.product-card {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 14px;
  align-items: stretch;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.product-image {
  min-height: 108px;
  border-radius: 6px;
  background: var(--image);
  display: grid;
  place-items: center;
  padding: 10px;
  text-align: center;
  color: #4a4842;
  font-weight: 750;
  word-break: break-word;
}

.product-card h2,
.line-item h2 {
  margin: 0;
  font-size: 20px;
}

.product-card p {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 15px;
}

.price {
  font-weight: 800;
  font-size: 20px;
}

.stock {
  color: var(--muted);
  font-size: 14px;
}

.sticky-action {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(251, 251, 248, 0.96);
  border-top: 1px solid var(--line);
  padding: 14px 18px 18px;
}

.sticky-action-inner {
  width: min(100%, 760px);
  margin: 0 auto;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.button:hover {
  background: var(--accent-dark);
}

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

.button.secondary {
  background: #ece7dd;
  color: var(--ink);
}

.button.success-button {
  background: var(--ok);
  color: white;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.lang-toggle {
  min-width: 48px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}

.form {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

label {
  font-weight: 760;
}

input {
  width: 100%;
  min-height: 52px;
  border: 1px solid #d8d1c7;
  border-radius: 8px;
  background: white;
  padding: 12px 14px;
  font: inherit;
}

input:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--accent);
}

input[type="checkbox"] {
  width: 24px;
  min-height: 24px;
  accent-color: var(--accent);
}

.hint {
  min-height: 22px;
  color: var(--muted);
  font-size: 15px;
}

.hint.ok {
  color: var(--ok);
}

.hint.bad,
.error {
  color: var(--danger);
}

.hp {
  position: absolute;
  left: -10000px;
  opacity: 0;
}

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

.line-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.line-meta {
  color: var(--muted);
  font-size: 15px;
}

.qty {
  display: grid;
  gap: 6px;
  justify-items: center;
}

.qty input {
  width: 72px;
  min-height: 46px;
  text-align: center;
}

.summary {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.summary.compact {
  margin-bottom: 14px;
}

.agent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.agent-head h1 {
  margin: 0;
  font-size: 24px;
}

.eyebrow {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.rate {
  display: grid;
  place-items: center;
  min-width: 70px;
  min-height: 54px;
  border-radius: 8px;
  background: #e5f2ee;
  color: var(--accent-dark);
  font-weight: 900;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 18px 0 10px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.tab {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.tab.active {
  background: var(--accent);
  color: white;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin: 8px 0;
}

.order-row {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.order-row.is-updating {
  opacity: 0.76;
}

.order-row-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 850;
}

.order-row small {
  color: var(--muted);
}

.status-badge {
  width: fit-content;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
}

.status-badge.pending {
  background: #fff1d6;
  color: #8a4b00;
}

.status-badge.paid {
  background: #dff5e8;
  color: #05603a;
}

.status-badge.shipping {
  background: #e5f2ee;
  color: var(--accent-dark);
}

.order-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.pay-box {
  display: grid;
  gap: 10px;
  padding: 14px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.pay-box div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.success {
  font-size: 34px;
  margin: 22px 0 8px;
}

.hidden {
  display: none !important;
}

@media (max-width: 430px) {
  .page {
    padding-inline: 14px;
  }

  .product-card {
    grid-template-columns: 94px 1fr;
  }

  .product-image {
    min-height: 94px;
    font-size: 14px;
  }
}
