:root {
  --gap: 12px;
  --border: #ddd;
  --primary: #111;
  --bg: #f9f9f9;
  --card: #fff;
  --focus: #0066cc;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
.bepro-wrap {
  margin: 0;
  padding: 16px;
  background: var(--bg);
  color: var(--primary);
  font-size: 15px;
  line-height: 1.5;
}
.container {
  max-width: 900px;
  margin: 0 auto;
}
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--gap);
  margin-bottom: 16px;
}
.col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; }
.col-3 { grid-column: span 3; }

/* Full-width on mobile */
@media (max-width: 768px) {
  .col-6, .col-4, .col-3, .col-8, .col-12 {
    grid-column: span 12;
  }
  .two-col {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
}

h1 {
  font-size: 20px;
  margin: 0 0 16px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

label {
  display: block;
  font-size: 14px;
  margin-bottom: 6px;
  color: #222;
  font-weight: 600;
}

input[type='text'],
input[type='number'],
input[type='email'],
input[type='date'],
textarea,
select.bepro-select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  min-height: 48px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0 16px;
  padding: 4px 0;
}
.chip {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 8px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  background: #f8f9fa;
  color: #333;
  min-width: 80px;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: all 0.2s;
  min-height: 48px;
}
.chip img {
  max-width: 100%;
  max-height: 40px;
  display: block;
  margin: 0 auto;
}
.chip:hover,
.chip:focus {
  background: #e9ecef;
}
.chip.selected {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.chip.selected img {
  filter: brightness(0) invert(1);
}

.section {
  background: var(--card);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  border: 1px solid #eee;
}
.section-title {
  font-weight: 700;
  margin: 0 0 14px;
  font-size: 16px;
  color: #111;
  padding-bottom: 8px;
  border-bottom: 1px solid #f0f0f0;
}

.inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 12px 8px 0;
  white-space: nowrap;
  font-size: 14px;
}
.inline input[type='checkbox'],
.inline input[type='radio'] {
  margin: 0;
  min-width: 20px;
  min-height: 20px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 16px;
}

/* Layout cards */
.layout-grid.layout-grid-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 12px;
}
.layout-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: #fff;
  cursor: pointer;
  user-select: none;
  transition: transform 0.2s, box-shadow 0.2s;
  min-height: 180px;
}
.layout-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}
.layout-card input[type="radio"] {
  display: none;
}
.layout-card img {
  width: 100%;
  height: 100px;
  background: #f8f9fa;
  border: 1px dashed #ddd;
  border-radius: 8px;
  object-fit: contain;
  flex-shrink: 0;
}
.layout-card .layout-code {
  font-weight: 700;
  color: #222;
  font-size: 14px;
}
.layout-card input[type="radio"]:checked ~ img {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.layout-card.selected,
.layout-card input[type="radio"]:checked + img + .layout-code {
  color: var(--primary);
}

/* Mobile: 2 columns for layout cards */
@media (max-width: 768px) {
  .layout-grid.layout-grid-cards {
    grid-template-columns: repeat(2, 1fr);
  }
  .layout-card {
    min-height: 160px;
  }
  .layout-card img {
    height: 80px;
  }
}

/* Live preview */
.layout-preview {
  width: 100%;
  border: 1px dashed var(--border);
  background: #fafafa;
  border-radius: 10px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 16px 0;
  min-height: 120px;
}
.layout-preview img {
  max-width: 100%;
  max-height: 100px;
  object-fit: contain;
  display: block;
}

/* Submit button */
.submit-btn {
  display: block;
  width: 100%;
  max-width: 280px;
  margin: 24px auto;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.submit-btn:hover,
.submit-btn:focus {
  background: #000;
  transform: translateY(-2px);
  outline: none;
}
.submit-btn:active {
  transform: translateY(0);
}

/* Print styles */
@media print {
  .submit-btn { display: none; }
  .section { box-shadow: none; border: 1px solid #000; }
  .bepro-wrap { background: #fff; color: #000; }
  * { -webkit-print-color-adjust: exact !important; color-adjust: exact !important; }
}

/* Success/error messages */
.bepro-message {
  margin: 12px 0;
  padding: 14px;
  border-radius: 10px;
  font-weight: 500;
}
.bepro-message.success {
  background: #f0fff4;
  border: 1px solid #c6f6d5;
  color: #2e8540;
}
.bepro-message.error {
  background: #fff5f5;
  border: 1px solid #feb2b2;
  color: #9b2c2c;
}
/* COMPACT TILE SIZE SECTION */
.tile-size-compact .tile-area-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  padding: 6px 0;
}
.tile-size-compact .tile-area-label {
  font-size: 13px;
  font-weight: 500;
  color: #444;
  width: 160px;
  flex-shrink: 0;
}
.tile-size-compact select.bepro-select {
  font-size: 14px;
  padding: 8px 10px;
  min-height: auto;
}
@media (max-width: 768px) {
  .tile-size-compact .tile-area-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .tile-size-compact .tile-area-label {
    width: auto;
  }
  @media (max-width: 768px) {
    .col-4 { grid-column: span 12; }
  }
}
/* === SUBMIT BUTTON WITH SPINNER === */
.submit-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 24px auto;
}
.submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 280px;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.submit-btn:hover:not(:disabled),
.submit-btn:focus:not(:disabled) {
  background: #000;
  outline: none;
}
.submit-btn:disabled {
  opacity: 0.8;
  cursor: not-allowed;
  transform: none !important;
}
/* DIMENSION PAIRS: Width + Length side-by-side */
.dimension-pair {
  display: flex;
  gap: 12px;
  margin: 12px 0;
}
.dimension-pair > div {
  flex: 1;
}
.dimension-pair label {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  font-weight: 600;
  color: #222;
}
/* Mobile: stack vertically */
@media (max-width: 768px) {
  .dimension-pair {
    flex-direction: column;
    gap: 8px;
  }
}
/* LIVE SQUARE FOOTAGE DISPLAY */
.live-sqft {
  margin-top: 8px;
  padding: 6px 10px;
  background: #f0f9ff;
  border: 1px solid #bee3f8;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #2b6cb0;
  display: inline-block;
}
/* Spinner */
.submit-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  visibility: hidden;
}
.submit-btn:disabled .submit-spinner {
  visibility: visible;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Success/error messages below button */
.submit-message {
  min-height: 24px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
}
.submit-message.success { color: #2e8540; }
.submit-message.error { color: #e53e3e; }