:root {
  --accent: #FF8C18;
  --accent-light: #FFB157;
  --dark: #020101;
  --light: #F9F8F8;
  --surface: #ffffff;
  --border: #ececea;
  --text: #17150f;
  --muted: #7a7772;
  --danger: #e0533d;
  --radius-lg: 20px;
  --radius-md: 12px;
  --shadow-card: 0 1px 2px rgba(20,16,8,0.04), 0 16px 40px -20px rgba(20,16,8,0.18);
  --shadow-btn: 0 10px 24px -8px rgba(255,140,24,0.55);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Albert Sans", sans-serif;
  background:
    radial-gradient(700px 420px at 12% 0%, rgba(255,140,24,0.07), transparent 60%),
    radial-gradient(600px 380px at 100% 20%, rgba(255,140,24,0.05), transparent 55%),
    var(--light);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* Hero */
.page-hero {
  position: relative;
  background-color: var(--dark);
  background-image: url("images/JBL-Ceiling-Speakers-Elevate-Audio-Website.png");
  background-repeat: no-repeat;
  background-position: right -60px bottom -40px;
  background-size: 520px auto;
  padding: 64px 24px 72px;
  text-align: center;
  overflow: hidden;
}
.page-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, var(--dark) 40%, rgba(2,1,1,0.75) 65%, rgba(2,1,1,0.35) 100%);
}
.page-hero-inner { position: relative; max-width: 720px; margin: 0 auto; }
.page-hero h1 {
  color: #fff;
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
}
.page-hero p { color: #cfcdc9; font-size: 16.5px; line-height: 1.6; margin: 0; }

/* Layout */
.builder-wrap {
  max-width: 1160px;
  margin: 0 auto 72px;
  padding: 56px 24px 0;
}

.builder-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.builder-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px 30px 32px;
  box-shadow: var(--shadow-card);
}

.card-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 22px;
}
.step-badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(150deg, var(--accent), #ff6a00);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  box-shadow: 0 6px 16px -4px rgba(255,110,0,0.5);
}
.card-head h2 { margin: 0 0 2px; font-size: 19px; font-weight: 700; color: var(--dark); letter-spacing: -0.01em; display: flex; align-items: center; gap: 9px; }
.hint { color: var(--muted); font-size: 13.5px; margin: 0; line-height: 1.5; }

.required-tag, .optional-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 3px 9px;
  border-radius: 20px;
}
.required-tag { background: rgba(255,140,24,0.14); color: var(--accent); }
.optional-tag { background: var(--light); color: var(--muted); border: 1px solid var(--border); }

/* Form fields */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.grid-span-3 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }

.field input,
.field select,
.field textarea {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 14px;
  font-size: 14.5px;
  font-family: inherit;
  background: #fbfbfa;
  color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.field select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9' fill='none'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%237a7772' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.field input::placeholder, .field textarea::placeholder { color: #b3b0aa; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255,140,24,0.14);
}
.field textarea { resize: vertical; min-height: 84px; }

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.checkbox-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex: none;
  accent-color: var(--accent);
  cursor: pointer;
}
.checkbox-field input[type="checkbox"]:disabled { cursor: not-allowed; opacity: .6; }
.checkbox-field:has(input:disabled) { cursor: not-allowed; color: var(--muted); }

.confirm-details-row {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.confirm-details-note { margin: 0; font-size: 12.5px; color: var(--muted); }
.confirm-details-note.confirmed { color: #1e8a4c; font-weight: 600; }

/* Product browser: left category rail + scrollable product list */
.product-browser {
  display: flex;
  gap: 22px;
  align-items: flex-start;
}

.category-rail {
  flex: none;
  width: 180px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-right: 1px solid var(--border);
  padding-right: 18px;
}
.category-item {
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.category-item:hover { background: #fbfbfa; color: var(--text); }
.category-item.active {
  background: linear-gradient(135deg, rgba(255,140,24,0.16), rgba(255,140,24,0.06));
  color: var(--dark);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--accent);
}

.product-list {
  flex: 1;
  min-width: 0;
  max-height: 460px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 6px;
}
.product-list::-webkit-scrollbar { width: 6px; }
.product-list::-webkit-scrollbar-thumb { background: #e3e0d9; border-radius: 10px; }

.product-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  background: #fbfbfa;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color .15s ease;
}
.product-item:hover { border-color: #ddd9d0; }
.product-item-image {
  flex: none;
  width: 56px;
  height: 56px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
}
.product-item-info { flex: 1; min-width: 0; }
.product-item-brand {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--accent);
}
.product-item-model { font-size: 13.5px; font-weight: 700; color: var(--dark); margin-top: 1px; }
.product-item-desc {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-item-price {
  flex: none;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--dark);
  white-space: nowrap;
  min-width: 92px;
  text-align: right;
}
.watt-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 8px;
  margin-left: 4px;
  vertical-align: middle;
}

/* Zone count + tabs */
.zone-count-field { max-width: 260px; margin-bottom: 20px; }

.zone-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.zone-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #fbfbfa;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 7px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.zone-tab:hover { border-color: #ddd9d0; color: var(--text); }
.zone-tab.active {
  background: linear-gradient(135deg, var(--accent-light), var(--accent) 70%);
  border-color: transparent;
  color: var(--dark);
  font-weight: 700;
}
.zone-tab-badge {
  background: rgba(2,1,1,0.14);
  color: inherit;
  font-size: 11px;
  font-weight: 700;
  border-radius: 20px;
  padding: 1px 7px;
}
.zone-tab.active .zone-tab-badge { background: rgba(2,1,1,0.18); }

.zone-editor { display: flex; flex-direction: column; gap: 20px; }

/* Mini section: selected items summary within a card */
.mini-section { margin-top: 4px; }
.mini-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--dark);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 10px;
}
.mini-section-summary { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: none; letter-spacing: 0; }

.mini-empty {
  font-size: 13px;
  color: var(--muted);
  background: #fbfbfa;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.mini-list { display: flex; flex-direction: column; gap: 8px; }
.mini-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #fbfbfa;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.mini-item-info { flex: 1; min-width: 0; }
.mini-item-model { font-size: 13px; font-weight: 700; color: var(--dark); }
.mini-item-qty { flex: none; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.mini-item-price { flex: none; font-size: 13px; font-weight: 700; color: var(--dark); min-width: 90px; text-align: right; }
.mini-item .remove-btn { width: 26px; height: 26px; }

.summary-validation { margin: -2px 0 0; font-size: 12px; color: var(--danger); text-align: center; }

.submit-status { margin: -2px 0 0; font-size: 12.5px; text-align: center; min-height: 1px; }
.submit-status:empty { display: none; }
.submit-status-ok { color: #1e8a4c; }
.submit-status-warn { color: #b6790a; }
.submit-status-error { color: var(--danger); }

.qty-btn {
  width: 26px;
  height: 26px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  line-height: 1;
}
.qty-btn:hover { border-color: var(--accent); color: var(--accent); }
.qty-input {
  width: 38px;
  text-align: center;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 5px 2px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
.qty-input::-webkit-inner-spin-button, .qty-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.btn-sm { padding: 9px 16px; font-size: 13px; flex: none; }

/* Quantity popup modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(23, 21, 15, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}
.qty-modal {
  position: relative;
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 26px 26px;
  box-shadow: 0 30px 60px -20px rgba(20,16,8,0.35);
  color: var(--text);
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border: none;
  background: var(--light);
  color: var(--muted);
  border-radius: 8px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover { background: #efece5; color: var(--text); }

.qty-modal-product {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.qty-modal-product img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  flex: none;
}
.qty-modal-brand {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--accent);
}
.qty-modal-model { font-size: 14px; font-weight: 700; color: var(--dark); margin-top: 1px; }

.qty-modal h3 { margin: 0 0 16px; font-size: 17px; font-weight: 700; color: var(--dark); }

.qty-modal-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 16px;
}
.qty-modal-stepper .qty-btn { width: 44px; height: 44px; font-size: 20px; }
.qty-modal-stepper .qty-input { width: 64px; height: 44px; font-size: 18px; font-weight: 700; }

.qty-modal-slider {
  width: 100%;
  accent-color: var(--accent);
  margin-bottom: 18px;
  cursor: pointer;
}

.qty-modal-price {
  text-align: center;
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 22px;
}
.qty-modal-price strong { color: var(--dark); font-weight: 700; }
.qty-modal-error { margin: 10px 0 0; font-size: 13px; font-weight: 600; color: var(--danger); text-align: center; line-height: 1.4; }
.qty-modal-error:empty { display: none; }

.amp-status {
  margin: 16px 0 0;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}
.amp-status-ok { background: #e9f6ee; color: #2f8a4c; }
.amp-status-warn { background: #fff4e6; color: #b45f00; }

.qty-modal-actions { display: flex; gap: 12px; }
.qty-modal-actions .btn { flex: 1; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 30px;
  padding: 12px 22px;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease, background .15s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent-light), var(--accent) 60%, #ff6a00);
  color: var(--dark);
  box-shadow: var(--shadow-btn);
}
.btn-primary:hover { box-shadow: 0 14px 30px -8px rgba(255,110,0,0.6); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: #d8d5cf; background: #fbfbfa; }
.btn-large { padding: 14px 26px; font-size: 15px; }
.btn-block { width: 100%; }

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
  font-size: 14px;
  background: #fbfbfa;
  border-radius: var(--radius-md);
  border: 1.5px dashed var(--border);
}
.empty-state svg { color: #d3d0c9; }

/* Items table */
.table-wrap { overflow-x: auto; }
.items-table { width: 100%; border-collapse: collapse; }
.items-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 1.5px solid var(--border);
  padding: 0 10px 10px;
}
.items-table td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: top;
}
.items-table tbody tr:hover { background: rgba(255,140,24,0.05); }
.items-table tr.group-row { background: var(--light); }
.items-table tr.group-row:hover { background: var(--light); }
.items-table tr.group-row td {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--dark);
  padding: 9px 10px;
}
.items-table td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--danger);
  cursor: pointer;
  transition: background .15s ease;
}
.remove-btn:hover { background: rgba(224,83,61,0.1); }
.item-brand { color: var(--muted); font-size: 12.5px; }

/* Sidebar / summary */
.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px 32px 32px;
  box-shadow: var(--shadow-card);
}
.summary-card h3 {
  margin: 0 0 22px;
  font-size: 18px;
  font-weight: 700;
  color: var(--dark);
  letter-spacing: -0.01em;
}

.summary-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
}
.summary-col-totals { flex: 1 1 260px; }
.summary-col-notes { flex: 1.6 1 320px; }
.summary-col-actions {
  flex: 0 0 220px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: flex-end;
}

.summary-empty {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.totals-block { display: flex; flex-direction: column; }
.totals-row {
  display: flex;
  justify-content: space-between;
  padding: 11px 0;
  font-size: 15.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.totals-grand {
  border-bottom: none;
  border-top: 2px solid var(--dark);
  font-weight: 800;
  font-size: 23px;
  color: var(--dark);
  padding-top: 16px;
  margin-top: 4px;
}
.totals-grand span:last-child { color: var(--accent); }

/* Footer */
.site-footer {
  background: var(--dark);
  color: #b8b8b8;
  text-align: center;
  padding: 24px 16px;
  font-size: 13px;
}

@media (max-width: 640px) {
  .grid-3 { grid-template-columns: 1fr; }
  .page-hero { background-image: none; padding: 48px 20px 56px; }
  .page-hero h1 { font-size: 28px; }
  .builder-wrap { padding: 40px 16px 0; }
  .card { padding: 22px 18px 24px; }
  .card-head { gap: 12px; }
  .summary-card { padding: 22px 18px 24px; }
  .summary-grid { flex-direction: column; gap: 22px; }
  .summary-col-totals, .summary-col-notes, .summary-col-actions { flex-basis: auto; }

  /* Category rail becomes a horizontal scrollable row above the list */
  .product-browser { flex-direction: column; gap: 14px; }
  .category-rail {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-right: 0;
    padding-bottom: 12px;
    gap: 6px;
  }
  .category-item { flex: none; white-space: nowrap; }
  .category-item.active { box-shadow: none; background: var(--accent); color: var(--dark); }
  .product-list { max-height: none; }
  .product-item { flex-wrap: wrap; }
  .product-item-info { flex-basis: 100%; order: 1; }
  .product-item-image { order: 0; }
  .product-item-price { order: 2; margin-right: auto; min-width: 0; text-align: left; font-size: 15px; }

  /* 16px inputs stop iOS Safari zooming the page whenever a field is tapped */
  .field input, .field select, .field textarea { font-size: 16px; }
  .add-row-btn { order: 3; }

  /* Restack the items table into cards instead of forcing horizontal scroll */
  .table-wrap { overflow-x: visible; }
  .items-table, .items-table thead, .items-table tbody, .items-table tr, .items-table td {
    display: block;
    width: 100%;
  }
  .items-table thead { display: none; }
  .items-table tr {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-bottom: 12px;
  }
  .items-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    text-align: right;
  }
  .items-table tr td:last-child { border-bottom: none; }
  .items-table td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--muted);
    text-align: left;
  }
  .items-table td.cell-remove { justify-content: flex-end; padding-top: 10px; }
  .items-table td.cell-remove::before { content: none; }
  .product-cell-value { display: flex; flex-direction: column; align-items: flex-end; }
  .item-brand { text-align: right; }

  .items-table tr.group-row { border: none; padding: 0; margin-bottom: 6px; background: transparent; }
  .items-table tr.group-row td {
    display: block;
    text-align: left;
    border-bottom: none;
    padding: 4px 2px;
  }
  .items-table tr.group-row td::before { content: none; }

  /* Zone tabs scroll horizontally on phones */
  .zone-tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  .zone-tab { flex: none; }

  .mini-item { flex-wrap: wrap; }
  .mini-item-info { flex-basis: 100%; }
  .mini-item-price { margin-left: auto; }
}
