/* Quote document: used on screen (summary cards, brand preview) and in the print / PDF window. */

.quote-doc {
  --q-primary: #137b76;
  --q-soft: rgba(19, 123, 118, 0.1);
  --q-accent: #d39a36;
  --q-font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  box-sizing: border-box;
  max-width: 820px;
  margin: 0 auto;
  background: #fff;
  color: #1b2b2c;
  font-family: var(--q-font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.quote-doc *,
.quote-doc *::before,
.quote-doc *::after {
  box-sizing: border-box;
}

.quote-doc h1,
.quote-doc h2,
.quote-doc h3,
.quote-doc p,
.quote-doc dl,
.quote-doc dd {
  margin: 0;
}

.q-bar {
  height: 8px;
  background: linear-gradient(90deg, var(--q-primary), var(--q-accent));
}

.q-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 32px 22px;
}

.q-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.q-logo {
  display: block;
  max-width: 150px;
  max-height: 64px;
  object-fit: contain;
}

.q-company {
  color: var(--q-primary);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.q-tagline {
  margin-top: 2px;
  color: #6a7c7d;
  font-size: 13px;
}

.q-title {
  flex: 0 0 auto;
  text-align: right;
}

.q-title h1 {
  color: var(--q-primary);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.q-meta {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: end;
  gap: 3px 14px;
  margin-top: 10px;
  font-size: 12.5px;
}

.q-meta dt {
  color: #6a7c7d;
  text-align: right;
}

.q-meta dd {
  font-weight: 600;
  text-align: right;
}

.q-parties {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  padding: 4px 32px 22px;
}

.q-party h3,
.q-section h2 {
  color: #7a8b8c;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.q-party h3 {
  margin-bottom: 6px;
}

.q-party p {
  font-size: 13.5px;
  overflow-wrap: anywhere;
}

.q-party strong {
  font-weight: 650;
}

.q-message {
  margin: 0 32px 22px;
  padding: 14px 18px;
  border-left: 3px solid var(--q-accent);
  border-radius: 0 10px 10px 0;
  background: #f6f9f9;
  font-size: 13.5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.q-section {
  padding: 0 32px 22px;
}

.q-section h2 {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e3ebeb;
  color: var(--q-primary);
}

.q-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 36px;
}

.q-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px dashed #e3ebeb;
  font-size: 13.5px;
}

.q-row span {
  color: #6a7c7d;
}

.q-row strong {
  font-weight: 650;
  text-align: right;
}

.q-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.q-chip {
  padding: 5px 13px;
  border-radius: 999px;
  background: var(--q-soft);
  color: var(--q-primary);
  font-size: 12.5px;
  font-weight: 650;
}

.q-total {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px 24px;
  margin: 4px 32px 24px;
  padding: 22px 26px;
  border-radius: 14px;
  background: var(--q-primary);
  color: #fff;
}

.q-total-label {
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.09em;
  opacity: 0.82;
  text-transform: uppercase;
}

.q-total-price {
  margin-top: 2px;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.q-total-meta {
  display: grid;
  gap: 5px;
  font-size: 13.5px;
  text-align: right;
}

.q-total-meta span {
  opacity: 0.85;
}

.q-alternates {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: -10px 32px 24px;
}

.q-alternate {
  padding: 8px 14px;
  border: 1px solid #e3ebeb;
  border-radius: 10px;
  font-size: 13px;
}

.q-alternate span {
  color: #6a7c7d;
}

.q-alternate strong {
  margin-left: 6px;
  font-weight: 700;
}

.q-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.q-table th,
.q-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #e3ebeb;
  text-align: right;
}

.q-table th:first-child,
.q-table td:first-child {
  text-align: left;
}

.q-table thead th {
  color: #7a8b8c;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.q-table tbody tr:nth-child(odd) {
  background: #f8fbfb;
}

.q-table td:first-child {
  font-weight: 650;
}

.q-table td:last-child {
  color: var(--q-primary);
  font-size: 15px;
  font-weight: 700;
}

.q-footer {
  display: grid;
  gap: 8px;
  padding: 18px 32px 26px;
  border-top: 1px solid #e3ebeb;
  color: #6a7c7d;
  font-size: 12.5px;
}

.q-footer p {
  overflow-wrap: anywhere;
}

.q-footer .q-thanks {
  color: var(--q-primary);
  font-size: 13.5px;
  font-weight: 650;
}

/* On-screen host for summary cards */

.quote-card-host {
  overflow: hidden;
  border: 1px solid #d9e5e2;
  border-radius: 12px;
  background: #fff;
}

.quote-card-host:empty {
  display: none;
}

.quote-card-empty {
  margin: 0;
  padding: 18px 20px;
  color: #617675;
  font-size: 14px;
}

@media (max-width: 640px) {
  .q-header {
    flex-direction: column;
    padding: 22px 20px 18px;
  }

  .q-title {
    text-align: left;
  }

  .q-meta {
    justify-content: start;
  }

  .q-meta dt,
  .q-meta dd {
    text-align: left;
  }

  .q-parties {
    grid-template-columns: minmax(0, 1fr);
    padding: 4px 20px 18px;
  }

  .q-section {
    padding: 0 20px 18px;
  }

  .q-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .q-message,
  .q-total,
  .q-alternates {
    margin-left: 20px;
    margin-right: 20px;
  }

  .q-footer {
    padding: 16px 20px 22px;
  }

  .q-total-meta {
    text-align: left;
  }

  .q-total-price {
    font-size: 30px;
  }
}

/* Print / save as PDF window */

.quote-print {
  margin: 0;
  background: #fff;
}

.quote-print .quote-doc {
  max-width: none;
}

@media print {
  @page {
    margin: 10mm;
  }

  .quote-doc {
    font-size: 13px;
  }

  .q-section,
  .q-total,
  .q-parties,
  .q-alternates,
  .q-footer,
  .q-table tr {
    break-inside: avoid;
  }
}

/* Header stays tidy in narrow cards */

.q-header {
  flex-wrap: wrap;
}

.q-brand {
  flex: 1 1 260px;
  flex-wrap: wrap;
}

.q-brand > div:last-child {
  flex: 1 1 140px;
  min-width: 0;
}

.q-company {
  overflow-wrap: break-word;
}

.q-title {
  flex: 1 1 220px;
}

.q-title h1 {
  font-size: 24px;
}

/* Roomier header and sections; long terms get their own block */

.q-header {
  gap: 28px 36px;
  padding: 38px 44px 32px;
}

.q-brand {
  gap: 22px;
}

.q-tagline {
  margin-top: 5px;
}

.q-title h1 {
  line-height: 1.2;
}

.q-meta {
  gap: 7px 20px;
  margin-top: 18px;
}

.q-parties {
  gap: 36px;
  padding: 8px 44px 34px;
}

.q-party h3 {
  margin-bottom: 12px;
}

.q-party p + p {
  margin-top: 3px;
}

.q-message {
  margin: 0 44px 30px;
  padding: 16px 20px;
}

.q-section {
  padding: 0 44px 30px;
}

.q-section h2 {
  margin-bottom: 14px;
  padding-bottom: 11px;
}

.q-row {
  padding: 9px 0;
}

.q-total {
  margin: 6px 44px 30px;
}

.q-alternates {
  margin: -14px 44px 30px;
}

.q-footer {
  gap: 14px;
  padding: 26px 44px 36px;
}

.q-terms-block h2 {
  margin-bottom: 8px;
  color: #7a8b8c;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.q-terms {
  color: #425556;
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre-wrap;
}

@media (max-width: 640px) {
  .q-header {
    padding: 28px 24px 24px;
  }

  .q-parties {
    padding: 4px 24px 26px;
  }

  .q-message,
  .q-total,
  .q-alternates {
    margin-left: 24px;
    margin-right: 24px;
  }

  .q-section {
    padding: 0 24px 26px;
  }

  .q-footer {
    padding: 22px 24px 28px;
  }
}

@media print {
  .q-footer {
    break-inside: auto;
  }

  .q-terms-block {
    break-inside: auto;
  }
}

/* Header: brand on top, title and details underneath */

.q-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}

.q-brand {
  flex: none;
}

.q-title {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 32px;
  padding-top: 24px;
  border-top: 1px solid #e3ebeb;
  text-align: left;
}

.q-title h1 {
  font-size: 26px;
  text-align: left;
}

.q-meta {
  margin: 0;
}

.q-meta dt {
  text-align: left;
}
