/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Helvetica Neue', Helvetica, sans-serif;
  background: #f5f5f5;
  padding: 24px;
  color: #111827;
}

/* ── Quote shell ── */
.quote-shell {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
  max-width: 760px;
  margin: 0 auto;
}
.quote-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: #111;
  border-bottom: 1px solid #111;
}
.quote-topbar span { font-size: 13px; font-weight: 600; color: #fff; }

/* ── Buttons ── */
.btn-dark {
  background: #18181b; color: #fff; border: none;
  padding: 5px 12px; border-radius: 6px; font-size: 11px; cursor: pointer;
}
.btn-dark:hover { background: #27272a; }
.btn-outline {
  background: #fff; border: 1px solid #111;
  padding: 6px 14px; border-radius: 6px; font-size: 11px; color: #111; cursor: pointer;
}
.btn-outline:hover { background: #f5f5f5; }

/* ── Add item row ── */
.add-item-row {
  padding: 12px 16px;
  border-top: 1px solid #e0e0e0;
  text-align: center;
}

/* ── Empty state ── */
.empty-state {
  padding: 40px;
  text-align: center;
  color: #999;
  font-size: 13px;
}

/* ── Accordion rows ── */
.qrow { border-bottom: 1px solid #e0e0e0; }
.qrow:last-child { border-bottom: none; }
.qrow-header {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  padding: 10px 16px; cursor: pointer; user-select: none;
}
.qrow-header:hover { background: #f5f5f5; }
.qrow.open .qrow-header {
  background: #ebebeb;
  border-top: 2px solid #111;
}
.qrow-num { display: none; }
.qrow-title {
  flex: 1 1 180px; font-size: 16px;
  min-width: 0; white-space: normal;
}
.qrow.open .qrow-title { color: #111; font-weight: 600; }
.qrow-prices { display: flex; align-items: center; gap: 8px; font-size: 12px; flex-shrink: 0; }
.price-list { color: #999; text-decoration: line-through; }
.price-sale { font-weight: 700; color: #111; }
.price-disc { font-size: 10px; color: #999; }
.qrow-caret { font-size: 10px; color: #999; margin-left: 4px; }
.header-remove {
  font-size: 16px; color: #bbb; cursor: pointer; flex-shrink: 0;
  background: none; border: none; padding: 0 2px; line-height: 1;
}
.header-remove:hover { color: #dc2626; }

/* ── Expanded body ── */
.qrow-body { display: none; padding: 14px 16px 16px; background: #f8f8f8; border-top: 1px solid #e0e0e0; }
.qrow.open .qrow-body { display: block; }

/* ── Qty stepper (collapsed row) ── */
.qty-stepper {
  display: flex; align-items: center;
  border: 1px solid #d4d4d4; border-radius: 6px; overflow: hidden; flex-shrink: 0;
}
.qty-stepper button {
  background: #f5f5f5; border: none; padding: 3px 7px;
  font-size: 13px; cursor: pointer; color: #333; line-height: 1;
}
.qty-stepper button:hover { background: #ebebeb; }
.qty-stepper input {
  width: 28px; border: none;
  border-left: 1px solid #e0e0e0; border-right: 1px solid #e0e0e0;
  text-align: center; font-size: 12px; padding: 3px 0;
  background: #fff; color: #111;
}

/* ── Qty stepper (expanded) ── */
.qty-stepper-lg {
  display: inline-flex; align-items: center;
  border: 1px solid #d4d4d4; border-radius: 6px; overflow: hidden;
}
.qty-stepper-lg button {
  background: #f5f5f5; border: none; padding: 4px 9px;
  font-size: 14px; cursor: pointer; color: #333; line-height: 1;
}
.qty-stepper-lg button:hover { background: #ebebeb; }
.qty-stepper-lg input {
  width: 32px; border: none;
  border-left: 1px solid #e0e0e0; border-right: 1px solid #e0e0e0;
  text-align: center; font-size: 12px; padding: 4px 0; background: #fff;
}

/* ── Step fields ── */
.step-fields { display: flex; flex-direction: column; gap: 9px; margin-bottom: 14px; }
.step-row { display: flex; align-items: flex-start; gap: 10px; }
.step-label {
  font-size: 14px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: #666; width: 100px; flex-shrink: 0; padding-top: 7px;
}

/* ── Pill group ── */
.pill-group { display: flex; flex-wrap: wrap; gap: 5px; }
.pill {
  padding: 4px 11px; border-radius: 999px;
  border: 1px solid #d4d4d4; font-size: 12px; cursor: pointer;
  background: #fff; color: #333;
}
.pill:hover { border-color: #111; color: #111; }
.pill.selected { background: #111; color: #fff; border-color: #111; }

/* ── Locked value ── */
.locked-value {
  display: inline-flex; align-items: center; gap: 6px;
  background: #f0f0f0; border: 1px solid #d4d4d4;
  border-radius: 999px; padding: 4px 10px; font-size: 12px; color: #333; font-weight: 500;
}
.locked-value .edit-btn {
  font-size: 10px; color: #666; cursor: pointer; text-decoration: underline;
  background: none; border: none;
}

/* ── Finish field ── */
.finish-field-wrap { display: flex; align-items: center; gap: 8px; }
.finish-tier-badge {
  font-size: 11px; font-weight: 600; color: #666;
  background: #f0f0f0; border: 1px solid #d4d4d4;
  border-radius: 4px; padding: 3px 7px; white-space: nowrap;
}

/* ── Selects ── */
.field-select {
  background: #fff; border: 1px solid #d4d4d4;
  border-radius: 6px; padding: 5px 10px; font-size: 12px; color: #111;
}

/* ── Toggle switch ── */
.switch-row { display: flex; align-items: center; gap: 8px; padding-top: 5px; }
.switch-track {
  width: 36px; height: 20px; background: #d4d4d4;
  border-radius: 999px; position: relative; cursor: pointer; flex-shrink: 0;
  transition: background .15s;
}
.switch-track.on { background: #111; }
.switch-thumb {
  width: 16px; height: 16px; background: #fff; border-radius: 50%;
  position: absolute; top: 2px; left: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: left .15s;
}
.switch-track.on .switch-thumb { left: 18px; }
.switch-label { font-size: 12px; color: #333; }

/* ── Section divider ── */
.divider { border: none; border-top: 1px solid #e0e0e0; margin: 12px 0; }

/* ── Sub-sections ── */
.section-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #666; }
.sub-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.section-badge { font-size: 10px; color: #999; font-style: italic; }

/* ── Item lines (mechanisms, addons) ── */
.item-line { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.item-sel {
  flex: 1; background: #fff; border: 1px solid #d4d4d4;
  border-radius: 6px; padding: 5px 10px; font-size: 12px; color: #111;
}
.item-qty {
  width: 48px; background: #fff; border: 1px solid #d4d4d4;
  border-radius: 6px; padding: 5px 8px; font-size: 12px; text-align: center;
}
.item-remove {
  color: #dc2626; font-size: 16px; line-height: 1;
  cursor: pointer; opacity: .4; padding: 0 2px; flex-shrink: 0;
  background: none; border: none;
}
.item-remove:hover { opacity: 1; }
.add-cta {
  font-size: 11px; color: #111; cursor: pointer; padding: 2px 0;
  display: inline-block; background: none; border: none;
}
.add-cta:hover { text-decoration: underline; }

/* ── BP/INV section ── */
.bp-section {
  background: #fff; border: 1px solid #e0e0e0;
  border-radius: 7px; padding: 9px 11px; margin-bottom: 8px;
}
.bp-section .section-label { color: #333; }

/* ── Other mechanisms section ── */
.other-mech-section {
  background: #f5f5f5; border: 1px solid #e0e0e0;
  border-radius: 7px; padding: 9px 11px; margin-bottom: 12px;
}

/* ── Contextual hint ── */
.ctx-hint {
  display: flex; align-items: center; gap: 6px;
  background: #fffbeb; border: 1px solid #fde68a;
  border-radius: 6px; padding: 6px 10px;
  font-size: 11px; color: #92400e; margin-bottom: 8px;
}
.ctx-hint .ctx-add {
  font-weight: 600; cursor: pointer; text-decoration: underline;
  color: #b45309; background: none; border: none; font-size: 11px;
}

/* ── Contextual addon highlight ── */
.item-sel.ctx-populated { background: #fffbeb; border-color: #fde68a; }

/* ── Pricing strip ── */
.price-strip { display: flex; align-items: center; gap: 10px; font-size: 12px; flex-wrap: wrap; }
.ps-label { color: #666; }
.ps-val { font-weight: 600; }
.ps-sep { color: #d4d4d4; }
.ps-disc { color: #999; font-size: 11px; }
.ps-sale { font-size: 13px; font-weight: 700; color: #111; }
.row-actions { margin-left: auto; }
.row-remove { font-size: 11px; color: #dc2626; cursor: pointer; background: none; border: none; }

/* ── Footer ── */
.quote-footer {
  padding: 14px 16px; background: #f5f5f5;
  border-top: 2px solid #e0e0e0;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
}
.footer-actions { display: flex; flex-direction: column; gap: 6px; align-self: flex-end; }
.footer-btn-row { display: flex; gap: 6px; }
.cogs-line { font-size: 10px; color: #999; }
.btn-internal-toggle {
  background: none; border: none; padding: 0;
  font-size: 10px; color: #bbb; cursor: pointer; text-decoration: underline;
}
.btn-internal-toggle:hover { color: #666; }
.footer-totals { display: flex; flex-direction: column; gap: 3px; min-width: 180px; }
.ft-row { display: flex; justify-content: space-between; gap: 16px; font-size: 12px; }
.ft-row .lbl { color: #666; }
.ft-row .val { font-weight: 500; color: #111; }
.ft-row .val.strike { color: #999; text-decoration: line-through; font-weight: 400; }
.ft-divider { border: none; border-top: 1px solid #e0e0e0; margin: 4px 0; }
.ft-sale-row { display: flex; justify-content: space-between; gap: 16px; }
.ft-sale-row .lbl { font-size: 13px; font-weight: 700; color: #111; }
.ft-sale-row .val { font-size: 18px; font-weight: 800; color: #111; }

/* ── Password gate overlay ── */
#password-gate {
  position: fixed; inset: 0; z-index: 999;
  display: flex; flex-direction: column;
  background: #f5f5f5;
}
.gate-topbar {
  background: #111; padding: 10px 16px; flex-shrink: 0;
}
.gate-topbar span { color: #fff; font-size: 13px; font-weight: 600; }
.gate-body {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.gate-card {
  background: #fff; border: 1px solid #e0e0e0; border-radius: 10px;
  padding: 32px 28px; width: 100%; max-width: 340px;
}
.gate-card h2 { font-size: 15px; font-weight: 700; color: #111; margin-bottom: 6px; }
.gate-card p { font-size: 12px; color: #666; margin-bottom: 16px; }
.gate-error { color: #dc2626 !important; }
#gate-input {
  width: 100%; padding: 8px 10px; border: 1px solid #d4d4d4; border-radius: 6px;
  font-size: 13px; color: #111; margin-bottom: 10px; outline: none;
  font-family: inherit;
}
#gate-input:focus { border-color: #111; }
#gate-submit {
  width: 100%; background: #111; color: #fff; border: none; border-radius: 6px;
  padding: 8px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
}
#gate-submit:hover:not(:disabled) { background: #27272a; }
#gate-submit:disabled { opacity: 0.5; cursor: default; }

/* ── Print / PDF ── */
@media print {
  body { background: #fff; padding: 0; }
  .quote-shell { border: none; border-radius: 0; max-width: 100%; }
  #add-item-btn, .footer-btn-row, .add-cta, .item-remove, .row-remove,
  .edit-btn, .qty-stepper button, .qty-stepper-lg button,
  #cogs-line { display: none !important; }
  .qrow-body { display: block !important; }
}
