/* REFTRIA 卸売台帳 — 通常版・デザイン版共通 */
.wholesale-wrap {
  --wholesale-rule: rgba(122, 86, 18, 0.2);
  --wholesale-ink: #5b4217;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wholesale-ledger-head {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  overflow: hidden;
  padding: 13px 15px 14px;
  border: 1px solid rgba(134, 92, 16, 0.34);
  border-radius: 11px;
  background:
    linear-gradient(96deg, rgba(255,255,255,0.6), transparent 48%),
    linear-gradient(180deg, rgba(255,250,231,0.96), rgba(239,225,185,0.9));
  box-shadow:
    0 5px 16px rgba(92, 61, 8, 0.09),
    inset 0 1px 0 rgba(255,255,255,0.85),
    inset 0 -1px 0 rgba(104,70,8,0.08);
}

.wholesale-ledger-head::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.35;
  background: repeating-linear-gradient(
    0deg,
    transparent 0 20px,
    rgba(116, 79, 15, 0.08) 20px 21px
  );
}

.wholesale-ledger-head::after {
  content: "";
  position: absolute;
  inset: 6px;
  z-index: -1;
  pointer-events: none;
  border: 1px solid rgba(156, 112, 24, 0.13);
  border-radius: 7px;
}

.wholesale-ledger-title {
  margin: 0;
  color: var(--wholesale-ink);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.wholesale-ledger-copy {
  margin: 3px 0 0;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.5;
}

.wholesale-rate {
  flex-shrink: 0;
  padding: 5px 8px;
  border: 1px solid rgba(125, 88, 17, 0.25);
  border-radius: 4px;
  background: rgba(255, 252, 239, 0.68);
  color: var(--gold-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.wholesale-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 9px 12px;
  padding: 10px 11px;
  border: 1px solid rgba(129, 91, 21, 0.16);
  border-radius: 8px;
  background: rgba(255, 252, 241, 0.54);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}

.wholesale-toolbar .inv-sort-row,
.wholesale-toolbar .inv-filter-nav {
  margin-bottom: 0;
}

.sell-ctrl {
  display: grid;
  grid-template-columns: auto auto minmax(112px, 1fr);
  gap: 8px;
  align-items: center;
}

.sell-ctrl .g-btn { margin-top: 0; }
.sell-ctrl .g-btn.primary {
  justify-self: end;
  width: auto;
  min-width: 112px;
}

.sell-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 58vh;
  max-height: 58dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid rgba(126, 89, 20, 0.24);
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(151, 111, 34, 0.035), transparent 20%),
    rgba(255, 252, 241, 0.76);
  box-shadow:
    0 5px 18px rgba(82, 55, 8, 0.08),
    inset 0 1px 0 rgba(255,255,255,0.76);
  scrollbar-color: rgba(139, 96, 17, 0.45) transparent;
}

.sell-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 124px;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 11px 13px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--wholesale-rule);
  border-radius: 0;
  font-size: 12px;
  cursor: pointer;
  box-shadow: none;
  transition: background-color 0.16s ease, box-shadow 0.16s ease;
}

.sell-row:last-child { border-bottom: 0; }
.sell-row:hover {
  border-color: var(--wholesale-rule);
  background: rgba(255, 242, 194, 0.32);
  box-shadow: none;
}
.sell-row:focus-within {
  background: rgba(255, 244, 205, 0.42);
  box-shadow: inset 3px 0 0 rgba(142, 96, 11, 0.54);
}
.sell-row:has(.sell-chk:checked) {
  background: linear-gradient(90deg, rgba(225, 183, 75, 0.2), rgba(255, 247, 218, 0.38));
  box-shadow: inset 3px 0 0 var(--gold-bright);
}

.sell-chk {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--gold-bright);
  cursor: pointer;
  flex-shrink: 0;
}

.sell-chk:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}

.sell-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sell-item-title {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
}

.sell-quality {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

.sell-item-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sell-item-ledger {
  display: grid;
  grid-template-columns: minmax(62px, auto) minmax(112px, auto);
  align-items: center;
  justify-content: end;
  gap: 11px;
  font-variant-numeric: tabular-nums;
}

.sell-stock-count,
.sell-price {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  justify-content: space-between;
  gap: 5px;
  margin-left: 0;
  white-space: nowrap;
}

.sell-meta-label,
.sell-quantity-label {
  color: var(--text-dim);
  font-family: inherit;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.sell-stock-count strong,
.sell-price strong {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

.sell-price strong { color: var(--gold-dim); }

.sell-quantity {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-self: end;
  width: 124px;
  gap: 3px;
}

.sell-quantity-label {
  padding-right: 2px;
  text-align: right;
}

.sell-qty-in {
  width: 52px !important;
  min-width: 52px;
  height: 32px;
  display: inline-block;
  margin-bottom: 0;
  padding: 5px 6px !important;
  text-align: center;
  font-variant-numeric: tabular-nums;
  appearance: textfield;
  -moz-appearance: textfield;
}
.sell-qty-in::-webkit-outer-spin-button,
.sell-qty-in::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.sell-qty-stepper {
  display: grid;
  grid-template-columns: 30px 52px 30px;
  gap: 4px;
  margin-left: 0;
}

.sell-qty-stepper .qty-step-btn {
  width: 30px;
  height: 30px;
  border-color: rgba(135, 94, 16, 0.32);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(255,248,219,0.98), rgba(228,207,151,0.94));
  color: #5f471d;
  font-size: 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.72), 0 1px 2px rgba(91,61,8,0.12);
  transition: transform 0.12s ease, border-color 0.12s ease, background-color 0.12s ease;
}

.sell-qty-stepper .qty-step-btn:active:not(:disabled) { transform: translateY(1px); }

body[data-theme="dark"] .wholesale-wrap {
  --wholesale-rule: rgba(229, 185, 90, 0.13);
  --wholesale-ink: var(--gold-bright);
}
body[data-theme="dark"] .wholesale-ledger-head {
  border-color: rgba(229,185,90,0.25);
  background: linear-gradient(180deg, rgba(49,45,37,0.96), rgba(32,35,48,0.96));
  box-shadow: 0 6px 18px rgba(0,0,0,0.24), inset 0 1px 0 rgba(255,255,255,0.07);
}
body[data-theme="dark"] .wholesale-rate,
body[data-theme="dark"] .wholesale-toolbar {
  border-color: rgba(229,185,90,0.18);
  background: rgba(35,43,66,0.58);
}
body[data-theme="dark"] .sell-list {
  border-color: rgba(229,185,90,0.18);
  background: rgba(31,38,58,0.78);
  box-shadow: 0 6px 18px rgba(0,0,0,0.24), inset 0 1px 0 rgba(255,255,255,0.04);
}
body[data-theme="dark"] .sell-row:hover { background: rgba(229,185,90,0.08); }
body[data-theme="dark"] .sell-row:focus-within { background: rgba(229,185,90,0.1); }
body[data-theme="dark"] .sell-row:has(.sell-chk:checked) {
  background: linear-gradient(90deg, rgba(229,185,90,0.16), rgba(48,58,86,0.22));
}
body[data-theme="dark"] .sell-qty-stepper .qty-step-btn {
  border-color: rgba(229,185,90,0.25);
  background: linear-gradient(180deg, rgba(58,62,77,0.98), rgba(37,43,62,0.98));
  color: var(--gold-bright);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 1px 2px rgba(0,0,0,0.28);
}

@media (max-width: 640px) {
  .wholesale-ledger-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
  .wholesale-rate { align-self: flex-start; }
  .wholesale-toolbar { padding: 9px; }
  .sell-ctrl { grid-template-columns: 1fr 1fr; }
  .sell-ctrl .g-btn { width: 100%; }
  .sell-ctrl .g-btn.primary {
    grid-column: 1 / -1;
    justify-self: stretch;
    width: 100%;
  }
  .sell-row {
    grid-template-columns: 17px minmax(0, 1fr) 124px;
    gap: 8px;
    padding: 10px;
  }
  .sell-item {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
  }
  .sell-item-ledger {
    grid-template-columns: minmax(48px, auto) minmax(0, 1fr);
    justify-content: stretch;
    gap: 7px;
  }
  .sell-stock-count,
  .sell-price { gap: 4px; }
}

@media (max-width: 360px) {
  .sell-row { grid-template-columns: 17px minmax(0, 1fr); }
  .sell-quantity {
    grid-column: 2;
    justify-self: start;
  }
  .sell-quantity-label { text-align: left; }
}
