/* Scrap buy — same counter language as Sale */
.scrap-counter .rates-chip {
  text-align: right;
  line-height: 1.15;
  margin-right: 4px;
}
.scrap-counter .rates-chip small {
  display: block;
  color: rgba(255,255,255,.65);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.scrap-counter .rates-chip strong {
  color: #fff;
  font-size: 13px;
  font-weight: 650;
}

.scrap-layout {
  grid-template-columns: minmax(280px, .85fr) minmax(0, 1.25fr);
}

.weight-board {
  padding: 8px 18px 18px;
  display: grid;
  gap: 8px;
}
.piece-label {
  margin: 10px 0 2px;
  color: #6a7380;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.piece-block {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}
.piece-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 4px 0 2px;
  color: #14283F;
  font-size: 15px;
  font-weight: 800;
}
.piece-add {
  width: 36px;
  height: 36px;
  border: 1px solid #d5dae2;
  border-radius: 10px;
  background: #fff;
  color: #14283F;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.piece-add:hover,
.piece-add:focus-visible {
  border-color: #14283F;
  outline: none;
}
.piece-picker {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px dashed #c8ced8;
  border-radius: 12px;
  background: #fafbfc;
}
.piece-picker[hidden] { display: none !important; }
.piece-picker button {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #d5dae2;
  border-radius: 10px;
  background: #fff;
  color: #14181f;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}
.piece-picker button:hover,
.piece-picker button:focus-visible {
  border-color: #14283F;
  outline: none;
}
.piece-added:empty { display: none; }
.karats { display: grid; gap: 8px; }

.karat-row {
  border: 1px solid #d5dae2;
  border-radius: 12px;
  background: #f4f6f8;
}
.karat-row.open {
  border-color: #14283F;
  background: #fff;
}
.karat-row .head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: #14181f;
}
.karat-row .k { width: 48px; font-weight: 800; color: #14283F; }
.karat-row .r { color: #6a7380; font-variant-numeric: tabular-nums; font-size: 13px; }
.karat-row .sum {
  margin-left: auto;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.karat-row .body { display: none; padding: 0 12px 12px; }
.karat-row.open .body { display: block; }

.grams {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 12px;
  border: 1px solid #d5dae2;
  border-radius: 12px;
  background: #fff;
}
.grams input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #14181f;
  -moz-appearance: textfield;
  appearance: textfield;
}
.grams input::-webkit-outer-spin-button,
.grams input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.grams span { color: #6a7380; font-size: 15px; }

.karat-total {
  display: grid;
  gap: 10px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid #d5dae2;
}
.karat-total small {
  display: block;
  color: #6a7380;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.karat-total > div > strong {
  font-size: 28px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  color: #14181f;
}

.agreed-under,
.pay-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  flex-wrap: wrap;
}
.agreed-under em,
.pay-line em {
  font-style: normal;
  color: #6a7380;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #d5dae2;
  border-radius: 12px;
  background: #fff;
  color: #14181f;
}
.box input,
.box select {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  height: 40px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #14181f;
}
.agreed-under .box { width: 160px; }
.pay-line .method { width: 180px; }
.pay-line .agreed .box { width: 140px; }
.bank-rest {
  height: 44px;
  display: flex;
  align-items: center;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: #14283F;
}
.field { display: block; }

.pad { padding: 8px 18px 18px; }
.pad .shot,
#photoPreview {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 12px;
  margin-top: 4px;
  background: #111;
  border: 1px solid #d5dae2;
}
.photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.sig {
  width: 100%;
  height: 140px;
  border: 1.5px dashed #d5dae2;
  border-radius: 12px;
  background: #f4f6f8;
  touch-action: none;
}

.ghost,
.primary {
  min-height: 48px;
  height: 48px;
  padding: 0 16px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  transition: background .15s ease, border-color .15s ease, filter .15s ease, transform .12s ease;
}
.ghost {
  border: 1px solid #d5dae2;
  background: #fff;
  color: #31445c;
}
.ghost:hover { background: #f7f9fc; border-color: #b8c2d0; }
.primary {
  border: 0;
  background: linear-gradient(180deg, #1a334f 0%, #14283F 100%);
  color: #fff;
  box-shadow: 0 8px 18px rgba(20, 40, 63, .22);
}
.primary:hover { filter: brightness(1.06); }
.primary:disabled { opacity: .6; cursor: wait; box-shadow: none; filter: none; }
.ghost:active, .primary:active { transform: translateY(1px); }

.photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.photo-actions .ghost,
.photo-actions .primary,
.photo-actions .photo-label {
  min-width: 140px;
}
.photo-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
.sr-camera {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}
.photo-hint {
  margin: 8px 0 0;
  font-size: 13px;
  color: #6a7380;
}

.piece-add {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid #cfd6e2;
  background: linear-gradient(180deg, #fff 0%, #f5f7fa 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,.9) inset;
}
.piece-picker button {
  min-height: 48px;
  border-radius: 12px;
  font-size: 15px;
  transition: border-color .15s ease, background .15s ease;
}
.piece-picker button:active { transform: translateY(1px); }

.dock-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.dock-actions .ghost {
  min-height: 48px;
  padding: 0 16px;
}
.dock-actions .primary-button {
  min-width: 168px;
  min-height: 48px;
}

.ask {
  position: fixed;
  inset: 0;
  background: rgba(20, 40, 63, .45);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 20;
}
.ask[hidden] { display: none !important; }
.ask article {
  width: min(440px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 22px;
}
.ask p { margin: 0 0 8px; font-size: 18px; }
.ask small { display: block; margin-bottom: 16px; color: #6a7380; }
.ask .choices { display: grid; gap: 8px; }
.ask button { min-height: 44px; border-radius: 12px; }

@media (max-width: 980px) {
  .scrap-layout { grid-template-columns: 1fr; }
  .dock-actions { width: 100%; }
  .dock-actions .primary-button { flex: 0 1 auto; }
}
