/* Reset / base styles */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: #f4f5f7;
  color: #222;
}
html {
  max-width: 100%;
  overflow-x: hidden;
}
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 100%;
  overflow-x: hidden;
}
img,
svg,
video,
canvas {
  max-width: 100%;
}
/* Header */
.app-header {
  background: #b01c2e;
  color: #fff;
  padding: 0.75rem 1.25rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}
.app-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}
.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.brand-mark {
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.1;
}
.brand-subtitle {
  font-size: 0.85rem;
  opacity: 0.9;
  line-height: 1.25;
}
.environment-pill {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex: 0 0 auto;
}
/* Body container */
#app {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 1.5rem auto;
  padding: 0 1rem 2rem;
  min-width: 0;
}
.app-footer {
  border-top: 1px solid #ddd;
  padding: 0.75rem 1.25rem;
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  color: #666;
  gap: 0.75rem;
}
/* Views & cards */
.view {
  display: none;
  min-width: 0;
}
.active-view {
  display: block;
}
.card {
  background: #fff;
  border-radius: 0.75rem;
  padding: 1.5rem 1.75rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  min-width: 0;
}
.card-wide {
  padding: 1.5rem 1.75rem 2rem;
}
.section-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
  min-width: 0;
}
.section-header h2 {
  margin-bottom: 0.25rem;
}
.view-subtitle {
  margin-top: 0.25rem;
  font-size: 0.9rem;
  color: #555;
}
/* Buttons */
.btn {
  border-radius: 999px;
  border: none;
  padding: 0.5rem 1.25rem;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  transition: transform 0.05s ease, box-shadow 0.05s ease, background-color 0.1s ease;
  min-height: 42px;
  text-align: center;
  white-space: normal;
}
.btn-primary {
  background-color: #b01c2e;
  color: #fff;
}
.btn-primary:hover {
  background-color: #941626;
}
.btn-secondary {
  background-color: #e3e6ea;
  color: #333;
}
.btn-secondary:hover {
  background-color: #d3d7dd;
}
.btn:active {
  transform: translateY(1px);
  box-shadow: none;
}
.btn-xs {
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  min-height: 32px;
}
/* Form layout */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.25rem;
  margin-top: 1rem;
  min-width: 0;
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}
.form-field.full-width {
  grid-column: 1 / -1;
}
label {
  font-weight: 600;
  font-size: 0.9rem;
}
input,
select,
textarea {
  border-radius: 0.5rem;
  border: 1px solid #ccd0d5;
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  font-family: inherit;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #b01c2e;
  box-shadow: 0 0 0 1px rgba(176, 28, 46, 0.15);
}
textarea {
  resize: vertical;
}
.helper-text {
  font-size: 0.8rem;
  color: #666;
}
.helper-text.small {
  font-size: 0.75rem;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.form-actions.spaced {
  justify-content: space-between;
}
.form-actions.centered {
  justify-content: center;
}
.step-actions-right {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
/* Dimension inputs */
.dimension-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(76px, 0.45fr);
  gap: 0.4rem;
  width: 100%;
}
.dimension-input input {
  max-width: none;
}
.dimension-input select {
  max-width: none;
}
/* List & summary */
.benefits-list {
  margin-top: 0.75rem;
  padding-left: 1.25rem;
  font-size: 0.95rem;
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
  margin-bottom: 1.5rem;
}
.summary-card {
  border-radius: 0.75rem;
  border: 1px solid #e0e3e8;
  background: #fafbfc;
  padding: 0.75rem 0.9rem;
  min-width: 0;
  overflow-wrap: anywhere;
}
.summary-card h3 {
  margin-top: 0;
  margin-bottom: 0.35rem;
  font-size: 0.95rem;
}
.totals-card {
  background: #fff;
}
.totals-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.9rem;
  margin-bottom: 0.1rem;
}
.totals-row-strong {
  font-weight: 700;
  margin-top: 0.3rem;
}
/* Line items table */
.lineitems-section {
  margin-top: 1rem;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.lineitems-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.lineitems-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 760px;
}
.lineitems-table th,
.lineitems-table td {
  border: 1px solid #e0e3e8;
  padding: 0.35rem 0.4rem;
  text-align: left;
  vertical-align: top;
}
.lineitems-table thead {
  background: #f1f3f6;
}
.lineitems-table tbody tr:nth-child(even) {
  background: #fafbfc;
}
/* Acknowledgement */
.acknowledgement {
  margin-top: 1.25rem;
  flex: 1;
  min-width: 0;
}
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.9rem;
}
.checkbox-row input[type="checkbox"] {
  width: auto;
  flex: 0 0 auto;
  margin-top: 0.2rem;
}
.dashboard-actions-wrapper {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  margin-top: 1.25rem;
  min-width: 0;
}
/* Inline options */
.inline-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.9rem;
}
.inline-options label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.inline-options input[type="radio"],
.inline-options input[type="checkbox"] {
  width: auto;
  flex: 0 0 auto;
}
/* Conditional sections */
.window-only,
.door-only,
.crossbar-details {
  border-radius: 0.5rem;
  border: 1px dashed #d0d4da;
  padding: 0.75rem;
  margin-top: 0.5rem;
  min-width: 0;
}
.window-only {
  background: #f8fafc;
}
.door-only {
  background: #fdf9f5;
}
.door-fields-vertical {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.hidden {
  display: none !important;
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
/* Banner */
.banner {
  max-width: 1100px;
  margin: 0.75rem auto 0;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
}
.banner-info {
  background: #eef3fb;
  color: #244163;
  border: 1px solid #c9d9f0;
}
.banner-error {
  background: #fbeaec;
  color: #7a1d26;
  border: 1px solid #f2c7cd;
}
/* Hardware diagram */
.hardware-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: flex-start;
  margin-top: 0.5rem;
  min-width: 0;
}
.hardware-controls {
  flex: 2 1 260px;
  min-width: 0;
}
.hardware-diagram-wrapper {
  flex: 1 1 160px;
  max-width: 100%;
}
.hardware-diagram {
  position: relative;
  width: 160px;
  height: 160px;
  border: 2px solid #555;
  border-radius: 4px;
  margin: 0 auto 0.25rem;
  background: #fff;
}
.hardware-side {
  position: absolute;
  display: flex;
  gap: 0.25rem;
}
.side-top,
.side-bottom {
  left: 4px;
  right: 4px;
  justify-content: space-around;
}
.side-top {
  top: 4px;
}
.side-bottom {
  bottom: 4px;
}
.side-left,
.side-right {
  top: 4px;
  bottom: 4px;
  flex-direction: column;
  justify-content: space-around;
}
.side-left {
  left: 4px;
}
.side-right {
  right: 4px;
}
.hardware-badge {
  padding: 0.15rem 0.3rem;
  border-radius: 999px;
  background: #b01c2e;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
}
.hardware-list-summary {
  margin-top: 0.25rem;
}
.hardware-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.hardware-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 0;
}
/* Image previews */
.swatch-preview,
.hardware-image-preview {
  margin-top: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
}
.swatch-preview img,
.hardware-image-preview img {
  width: 48px;
  height: 48px;
  border-radius: 0.35rem;
  border: 1px solid #d0d4da;
  object-fit: cover;
}
.hardware-image-caption,
#hardwareImageCaption {
  overflow-wrap: anywhere;
}
/* Stepper */
.screen-form {
  margin-top: 0.5rem;
}
.step-indicator {
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 0.75rem;
}
.screen-step {
  display: none;
}
.screen-step.active-step {
  display: block;
}
/* Responsive tweaks */
@media (max-width: 900px) {
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dashboard-actions-wrapper {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
}
@media (max-width: 640px) {
  #app {
    margin-top: 0.75rem;
    padding: 0 0.7rem 1.25rem;
  }
  .app-header {
    padding: 0.65rem 0.8rem;
  }
  .app-header-inner {
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
  }
  .brand {
    gap: 0.55rem;
    flex: 1 1 auto;
  }
  .brand-logo {
    height: 34px;
    flex: 0 0 auto;
  }
  .brand-mark {
    font-size: 1.05rem;
  }
  .brand-subtitle {
    font-size: 0.74rem;
    max-width: 13rem;
  }
  .environment-pill {
    font-size: 0.65rem;
    padding: 0.2rem 0.55rem;
  }
  .card,
  .card-wide {
    border-radius: 0.65rem;
    padding: 1rem 0.9rem 1.25rem;
  }
  .card h1 {
    font-size: 1.55rem;
    line-height: 1.12;
  }
  .form-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }
  .summary-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }
  .summary-card {
    padding: 0.72rem 0.8rem;
  }
  .section-header {
    flex-direction: column;
    align-items: stretch;
  }
  .section-header .btn,
  #btnAddScreen {
    width: 100%;
  }
  .lineitems-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
  }
  .lineitems-table {
    font-size: 0.78rem;
    min-width: 720px;
  }
  .hardware-grid {
    flex-direction: column;
  }
  .hardware-controls {
    width: 100%;
    flex-basis: auto;
  }
  .hardware-diagram-wrapper {
    flex: none;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .dashboard-actions-wrapper {
    flex-direction: column;
    align-items: stretch;
  }
  .form-actions,
  .form-actions.spaced,
  .step-actions-right {
    width: 100%;
    justify-content: stretch;
  }
  .form-actions .btn,
  .step-actions-right .btn,
  #btnSubmitQuote,
  #btnNewQuote {
    flex: 1 1 100%;
    width: 100%;
  }
  .inline-options {
    flex-direction: column;
    gap: 0.5rem;
  }
  .window-only,
  .door-only,
  .crossbar-details {
    padding: 0.65rem;
  }
  .swatch-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .swatch-tile {
    min-width: 0;
  }
  .app-footer {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.75rem 0.85rem;
  }
}
@media (max-width: 380px) {
  #app {
    padding-left: 0.55rem;
    padding-right: 0.55rem;
  }
  .card,
  .card-wide {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  .brand-subtitle {
    max-width: 10.5rem;
  }
  .swatch-tiles {
    grid-template-columns: 1fr;
  }
  .dimension-input {
    grid-template-columns: minmax(0, 1fr) minmax(70px, 0.5fr);
  }
}

/* Brand logo in the red band */
.brand-logo {
  height: 36px;
  max-height: 90%;
  width: auto;
  display: block;
}

/* Force better wrapping in summary cards */
.info-lines > div,
#summaryCustomer,
#summaryStore,
#successCustomer,
#successStore,
#successQuoteId {
  line-height: 1.35;
  overflow-wrap: anywhere;
}

/* Swatch tiles */
.swatch-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.swatch-tile {
  border: 2px solid #d0d4da;
  border-radius: 0.65rem;
  background: #fff;
  padding: 0.5rem 0.4rem 0.6rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
}
.swatch-tile.is-selected {
  border-color: #b01c2e;
  box-shadow: 0 0 0 2px rgba(176, 28, 46, 0.2);
  background: #fff7f8;
}
.swatch-tile:focus-visible {
  outline: 2px solid #b01c2e;
  outline-offset: 2px;
}
.swatch-chip {
  width: 54px;
  height: 54px;
  border-radius: 0.5rem;
  border: 1px solid rgba(0,0,0,0.12);
  background: #f0f0f0;
  background-size: cover;
  background-position: center;
}
.swatch-label {
  font-size: 0.75rem;
  text-align: center;
}

/* Prefer vertical stacking for form grids */
.form-grid.two-col {
  grid-template-columns: 1fr !important;
}

#crossbarDecision { max-width: 320px; }

#successPaymentLink {
  font-size: 1.15rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .swatch-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 380px) {
  .swatch-tiles {
    grid-template-columns: 1fr;
  }
}
