* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 20px;
  background: #f1f1f1;
  color: #202223;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
}

.hidden { display: none !important; }
.center { text-align: center; margin: 16px 0; }
.err { color: #d72c0d; }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 10px; margin-bottom: 18px; }
.tab {
  border: 0;
  background: #e3e3e3;
  color: #6d7175;
  padding: 11px 22px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}
.tab.active { background: #1a1a1a; color: #fff; }

.panel { display: none; }
.panel.active { display: block; }

/* ---- Boxes ---- */
.box {
  background: #fff;
  border: 1px solid #e1e3e5;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 14px;
}
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row label { font-size: 15px; white-space: nowrap; }

input, select {
  border: 1px solid #8c9196;
  border-radius: 4px;
  padding: 9px 11px;
  font-size: 14px;
  background: #fff;
  color: #202223;
  min-width: 0;
}
#rateInput { flex: 1; max-width: 320px; }
#productSearch { flex: 1; max-width: 460px; }

.btn {
  border: 1px solid #8c9196;
  background: #fff;
  color: #202223;
  border-radius: 6px;
  padding: 10px 18px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}
.btn.dark { background: #1a1a1a; border-color: #1a1a1a; color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 7px 14px; font-size: 13px; }

.status { font-size: 13px; color: #6d7175; white-space: pre-wrap; }

/* ---- Product list ---- */
.product {
  background: #fff;
  border: 1px solid #e1e3e5;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.product-head { display: flex; align-items: center; gap: 12px; }
.product-head strong { font-size: 16px; flex: 1; }
.product-head img { width: 34px; height: 34px; border-radius: 4px; object-fit: cover; }

.variants { margin-top: 14px; display: grid; gap: 12px; }

.variant {
  background: #fbfbfb;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  overflow: hidden;
}

/* variant header strip */
.v-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #f2f3f4;
  border-bottom: 1px solid #e6e6e6;
}
.v-name { font-weight: 600; font-size: 14px; }
.v-sku {
  font-size: 11px;
  color: #6d7175;
  background: #fff;
  border: 1px solid #e1e3e5;
  border-radius: 20px;
  padding: 2px 9px;
}
.v-current { margin-left: auto; font-size: 13px; color: #6d7175; white-space: nowrap; }
.v-current b { color: #202223; }

/* variant fields */
.v-body {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding: 14px 16px;
  flex-wrap: wrap;
}
.f { display: flex; flex-direction: column; gap: 5px; }
.f label { font-size: 12px; color: #6d7175; }
.f input { width: 128px; }
.f-pair { display: flex; gap: 6px; }
.f-pair select { width: 58px; }
.f-pair input { width: 100px; }

/* calculated price block */
.calc {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  border: 1px solid #e1e3e5;
  border-radius: 8px;
  padding: 9px 14px;
}
.calc-lines { display: grid; gap: 2px; font-size: 11.5px; color: #6d7175; }
.calc-lines b { color: #202223; font-weight: 600; margin-left: 4px; }
.calc-total {
  font-size: 20px;
  font-weight: 700;
  border-left: 1px solid #e1e3e5;
  padding-left: 16px;
  white-space: nowrap;
}

.v-body .save { align-self: flex-end; }

@media (max-width: 900px) {
  .calc { margin-left: 0; width: 100%; justify-content: space-between; }
}

/* ---- Login ---- */
.login { display: grid; place-items: center; min-height: 70vh; }
.login-box {
  background: #fff; border: 1px solid #e1e3e5; border-radius: 8px;
  padding: 28px; width: 300px; text-align: center;
}
.login-box input, .login-box button { width: 100%; margin-top: 10px; }
.login-box button {
  background: #1a1a1a; color: #fff; border: 0;
  border-radius: 6px; padding: 10px; cursor: pointer;
}

/* ---- Toast ---- */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #1a1a1a; color: #fff; padding: 11px 20px;
  border-radius: 6px; font-size: 13px; z-index: 50;
}
.toast.err { background: #d72c0d; }
