/* ===== Buy Modal ===== */
:root {
  --bm-green: #6366f1;
  --bm-green-light: #eef2ff;
  --bm-green-dark: #4f46e5;
  --bm-border: #d0d0d0;
  --bm-border-light: #e8e8e8;
  --bm-text: #2c2c2c;
  --bm-text-secondary: #777;
  --bm-bg: #fff;
  --bm-bg-muted: #f7f7f7;
  --bm-radius: 4px;
  --bm-shadow: 0 2px 12px rgba(0,0,0,.14);
  --bm-font: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}

.bm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.bm-overlay.active { display: flex; }

.bm-modal {
  background: var(--bm-bg);
  width: 500px;
  max-width: calc(100% - 24px);
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--bm-border);
  border-radius: var(--bm-radius);
  box-shadow: var(--bm-shadow);
  font-family: var(--bm-font);
  font-size: 13px;
  color: var(--bm-text);
  position: relative;
}

/* Header */
.bm-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 16px;
  border-bottom: 1px solid var(--bm-border);
  background: var(--bm-bg-muted);
}
.bm-header-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .3px;
}
.bm-header-close {
  background: none;
  border: none;
  font-size: 20px;
  color: #aaa;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}
.bm-header-close:hover { color: #666; }

/* Description */
.bm-desc {
  padding: 12px 16px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--bm-text);
  border-bottom: 1px solid var(--bm-border-light);
}

/* Steps */
.bm-steps {
  display: flex;
  border-bottom: 1px solid var(--bm-border);
}
.bm-step {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  font-size: 11px;
  font-weight: 700;
}
.bm-step-done {
  background: var(--bm-green-light);
  color: var(--bm-green);
  border-right: 1px solid var(--bm-border);
}
.bm-step-active {
  background: var(--bm-green);
  color: #fff;
}

/* Section headers */
.bm-section-head {
  padding: 8px 16px;
  background: var(--bm-bg-muted);
  border-bottom: 1px solid var(--bm-border-light);
  font-size: 11px;
  font-weight: 700;
  color: var(--bm-text-secondary);
}

/* Vendors */
.bm-vendors {
  padding: 6px 16px;
  border-bottom: 1px solid var(--bm-border-light);
}
.bm-vendor {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  cursor: pointer;
  font-size: 12px;
  border-bottom: 1px solid #f2f2f2;
}
.bm-vendor:last-child { border-bottom: none; }
.bm-vendor input[type="radio"] {
  margin: 0;
  accent-color: var(--bm-green);
  flex-shrink: 0;
}
.bm-vendor-info { flex: 1; }
.bm-vendor-name { font-weight: 600; color: var(--bm-text); }
.bm-vendor-meta { font-size: 11px; color: #aaa; margin-left: 6px; }
.bm-vendor-stock { color: #64748b; }
.bm-vendor-sold { color: var(--bm-green); font-weight: 500; }
.bm-vendor-price { font-weight: 700; font-size: 14px; white-space: nowrap; text-align: right; }
.bm-vendor-price-sub { display: block; font-size: 9px; font-weight: 400; color: #aaa; }

/* Form */
.bm-form {
  padding: 10px 16px;
}
.bm-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f2f2f2;
}
.bm-field:last-child { border-bottom: none; }
.bm-label {
  font-size: 12px;
  color: #555;
  flex-shrink: 0;
}
.bm-input {
  padding: 5px 8px;
  border: 1px solid var(--bm-border);
  border-radius: var(--bm-radius);
  font-size: 12px;
  color: var(--bm-text);
  outline: none;
  background: #fff;
  width: 200px;
  box-sizing: border-box;
}
.bm-input:focus { border-color: var(--bm-green); }
.bm-select {
  padding: 5px 8px;
  border: 1px solid var(--bm-border);
  border-radius: var(--bm-radius);
  font-size: 12px;
  color: var(--bm-text);
  background: #fff;
  width: 200px;
  box-sizing: border-box;
}

/* Price row */
.bm-price-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 16px;
  border-top: 1px solid #e2e8f0;
  margin-top: 2px;
}
.bm-price-label { font-size: 13px; font-weight: 700; }
.bm-price-value { font-size: 18px; font-weight: 700; color: var(--bm-green); }
.bm-price-sub { font-size: 10px; color: var(--bm-green); text-align: right; padding: 0 16px 4px; }

/* Footer */
.bm-footer {
  padding: 8px 16px 14px;
  border-top: 1px solid var(--bm-border-light);
}
.bm-checkbox {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: #666;
  cursor: pointer;
  margin-bottom: 10px;
}
.bm-checkbox input { margin: 0; accent-color: var(--bm-green); }
.bm-checkbox a { color: var(--bm-green); text-decoration: none; }
.bm-checkbox a:hover { text-decoration: underline; }

.bm-btn {
  display: block;
  width: 100%;
  padding: 10px 0;
  background: var(--bm-green);
  color: #fff;
  border: 1px solid var(--bm-green-dark);
  border-radius: var(--bm-radius);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--bm-font);
  text-align: center;
  transition: background .15s;
}
.bm-btn:hover { background: var(--bm-green-dark); }
.bm-btn:disabled { opacity: .5; cursor: not-allowed; }

/* Warning */
.bm-warn {
  display: none;
  padding: 7px 10px;
  background: #fff5f5;
  border: 1px solid #f0c0c0;
  border-radius: var(--bm-radius);
  margin: 6px 16px;
  font-size: 11px;
  color: #c62828;
}
.bm-warn a { color: var(--bm-text); text-decoration: underline; }

/* Result */
.bm-result { padding: 0 16px 10px; }
.bm-result-ok { text-align: center; padding: 12px 0; }
.bm-result-ok-title { font-size: 14px; font-weight: 700; color: var(--bm-green); margin-bottom: 4px; }
.bm-result-ok-sub { font-size: 12px; color: #888; margin-bottom: 10px; }
.bm-result-dl {
  display: inline-block;
  padding: 7px 18px;
  background: #333;
  color: #fff;
  border-radius: var(--bm-radius);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}
.bm-result-err {
  padding: 6px 10px;
  background: #fff5f5;
  border: 1px solid #f0c0c0;
  border-radius: var(--bm-radius);
  text-align: center;
  font-size: 11px;
  color: #c62828;
}

/* Coupon msg */
.bm-coupon-msg {
  display: none;
  font-size: 11px;
  padding: 2px 16px 4px;
}

/* Loading */
.bm-loading {
  padding: 32px;
  text-align: center;
  color: #aaa;
  font-size: 12px;
}
