/* Client document (quote / engagement agreement). Always light, print-first. */
.qd {
  --qd-ink: #031432;
  --qd-ink-2: #36415E;
  --qd-muted: #5B6680;
  --qd-line: #E4E7EF;
  --qd-soft: #F6F4FE;
  --qd-soft-2: #FAFBFD;
  --qd-accent: #5302DF;
  --qd-pink: #F82272;
  font-family: 'Rubik', system-ui, sans-serif;
  font-feature-settings: 'tnum';
  color: var(--qd-ink);
  background: #FFFFFF;
  width: 100%;
  max-width: 840px;
  margin-inline: auto;
  padding: 48px 56px 32px;
  font-size: 14px;
  line-height: 1.6;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  position: relative;
}
.qd *, .qd *::before, .qd *::after { box-sizing: border-box; }
.qd .num { font-variant-numeric: tabular-nums; }
.qd::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 5px;
  background: linear-gradient(90deg, var(--qd-pink), var(--qd-accent) 60%, var(--qd-ink));
}

/* Header */
.qd-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.qd-type {
  display: inline-block; font-size: 11.5px; font-weight: 500; color: var(--qd-accent);
  background: var(--qd-soft); border-radius: 999px; padding: 2px 10px; margin-bottom: 8px;
}
.qd-top h1 { margin: 0; font-size: 34px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.qd-meta { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 10px; color: var(--qd-muted); font-size: 13px; }
.qd-meta b { color: var(--qd-ink); font-weight: 600; }
.qd-logo { height: 76px; width: auto; display: block; }

/* Parties */
.qd-parties {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin-top: 28px;
  border: 1px solid var(--qd-line); border-radius: 12px; overflow: hidden;
}
.qd-party { padding: 16px 18px; font-size: 13px; color: var(--qd-ink-2); line-height: 1.55; }
.qd-party + .qd-party { border-inline-start: 1px solid var(--qd-line); background: var(--qd-soft-2); }
.qd-label { font-size: 11.5px; font-weight: 500; color: var(--qd-muted); margin-bottom: 4px; }
.qd-party-name { font-size: 15px; font-weight: 600; color: var(--qd-ink); margin-bottom: 2px; }
.qd-party-name.qd-client { font-size: 18px; }
.qd-ltr { text-align: right; }

/* Hero figures */
.qd-hero {
  display: grid; grid-template-columns: 1.2fr 1fr 1fr; margin-top: 16px;
  border-radius: 12px; background: var(--qd-soft); border: 1px solid #E4DCFB;
}
.qd-stat { padding: 16px 18px; }
.qd-stat + .qd-stat { border-inline-start: 1px solid #E4DCFB; }
.qd-stat-label { font-size: 12px; color: var(--qd-muted); }
.qd-stat-value { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; margin-top: 2px; }
.qd-stat.is-main .qd-stat-value { font-size: 30px; color: var(--qd-accent); }
.qd-stat-sub { font-size: 12px; color: var(--qd-muted); }

/* Sections */
.qd-section { margin-top: 30px; }
.qd-sec-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid var(--qd-ink);
}
.qd-sec-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.qd-aside { font-size: 12px; color: var(--qd-muted); }

.qd-pkg { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 14px; }
.qd-pkg-name { font-size: 20px; font-weight: 600; }
.qd-pkg-inf { color: var(--qd-ink-2); }
.qd-pkg-price { text-align: end; font-size: 20px; font-weight: 600; }
.qd-pkg-price small, .qd-row-price small { display: block; font-size: 11.5px; font-weight: 400; color: var(--qd-muted); }

.qd-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.qd-cell {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--qd-line); border-radius: 10px; break-inside: avoid;
}
.qd-cell-n { flex: none; min-width: 34px; font-size: 22px; font-weight: 600; color: var(--qd-accent); line-height: 1; }
.qd-cell-l { font-size: 13px; color: var(--qd-ink-2); line-height: 1.4; }
.qd-checks { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.qd-checks li { font-size: 13px; color: var(--qd-ink-2); }
.qd-checks li::before { content: '✓'; color: #0B7A4B; font-weight: 700; margin-inline-end: 6px; }

.qd-rows { display: grid; }
.qd-row {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 10px 0; border-bottom: 1px solid var(--qd-line); break-inside: avoid;
}
.qd-row:last-child { border-bottom: 0; }
.qd-row-price { text-align: end; font-weight: 600; white-space: nowrap; }
.qd-strong { font-weight: 600; }
.qd-muted { color: var(--qd-muted); font-size: 13px; }
.qd-tag {
  font-size: 11.5px; font-weight: 500; color: var(--qd-accent); white-space: nowrap;
  background: var(--qd-soft); border-radius: 999px; padding: 2px 10px;
}

/* Price table */
.qd-table { width: 100%; border-collapse: collapse; }
.qd-table th, .qd-table td { text-align: start; padding: 9px 0; border-bottom: 1px solid var(--qd-line); vertical-align: top; }
.qd-table thead th { font-size: 12px; font-weight: 500; color: var(--qd-muted); padding-top: 0; }
.qd-table tbody th { font-weight: 400; color: var(--qd-ink-2); }
.qd-table .amt { text-align: left; white-space: nowrap; padding-inline-start: 20px; width: 20%; }
.qd-table tr { break-inside: avoid; }
.qd-table tr.sub th, .qd-table tr.sub td { font-weight: 600; color: var(--qd-ink); }
.qd-table tr.total th, .qd-table tr.total td {
  font-weight: 700; color: var(--qd-ink); font-size: 15px; border-bottom: 0;
  background: var(--qd-soft); padding: 11px 0;
}
.qd-table tr.total th { padding-inline-start: 12px; border-radius: 0 8px 8px 0; }
.qd-table tr.total td:last-child { padding-inline-end: 12px; border-radius: 8px 0 0 8px; }
.qd-table tr.total td.amt { padding-inline-start: 20px; }
.qd-table tr.discount th, .qd-table tr.discount td { color: #0B7A4B; }
.qd-valid { color: var(--qd-pink); font-weight: 500; }
.qd-disclaimer { margin: 10px 0 0; font-size: 12px; color: var(--qd-muted); line-height: 1.55; }
.qd-consent { margin: 8px 0 0; font-size: 11.5px; color: var(--qd-ink-2); line-height: 1.5; }
.qd-terms {
  margin: 14px 0 0; padding: 12px 14px; border-radius: 10px; border: 1px dashed #CFD4E2;
  font-size: 12.5px; color: var(--qd-ink-2);
}
.qd-notes { white-space: pre-line; margin: 0; }

/* Legal */
.qd-clauses { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 28px; }
.qd-clauses > li { break-inside: avoid; margin-bottom: 14px; }
.qd-clauses h3 { margin: 0 0 4px; font-size: 13.5px; font-weight: 600; }
.qd-clauses ol { list-style: none; margin: 0; padding: 0; }
.qd-clauses ol li { display: flex; gap: 8px; font-size: 12.5px; color: var(--qd-ink-2); line-height: 1.55; margin-bottom: 4px; }
.qd-cl-n { flex: none; min-width: 26px; color: var(--qd-muted); }
.qd-cl-h { display: inline-block; min-width: 26px; color: var(--qd-accent); }

/* Signatures */
.qd-sign-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.qd-sign-box { border: 1px solid var(--qd-line); border-radius: 12px; padding: 14px 16px; min-height: 120px; break-inside: avoid; }
.qd-sign-box.is-signed { border-color: #BFE6D2; background: #F3FBF7; }
.qd-sign-box img { display: block; max-width: 100%; height: 70px; object-fit: contain; object-position: right; margin: 6px 0; }
.qd-line { height: 44px; border-bottom: 1px solid var(--qd-ink-2); margin: 6px 0 6px; }

.qd-foot {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-top: 32px; padding-top: 12px; border-top: 1px solid var(--qd-line);
  font-size: 11px; color: var(--qd-muted);
}
.qd-hashes { display: flex; gap: 14px; }

@media (max-width: 640px) {
  .qd { padding: 28px 18px 24px; }
  .qd-top { flex-direction: column-reverse; gap: 14px; }
  .qd-top h1 { font-size: 28px; }
  .qd-logo { height: 56px; }
  .qd-parties { grid-template-columns: 1fr; }
  .qd-party + .qd-party { border-inline-start: 0; border-top: 1px solid var(--qd-line); }
  .qd-hero { grid-template-columns: 1fr 1fr; }
  .qd-stat.is-main { grid-column: 1 / -1; }
  .qd-stat + .qd-stat { border-inline-start: 0; border-top: 1px solid #E4DCFB; }
  .qd-stat:last-child { border-inline-start: 1px solid #E4DCFB; }
  .qd-grid { grid-template-columns: 1fr 1fr; }
  .qd-pkg { flex-direction: column; align-items: flex-start; }
  .qd-pkg-price { text-align: start; }
  .qd-clauses { columns: 1; }
  .qd-sign-grid { grid-template-columns: 1fr; }
  .qd-table .amt { padding-inline-start: 12px; width: auto; }
  .qd-table tr.total th, .qd-table tr.total td { font-size: 13.5px; }
  .qd-table tr.total td.amt { padding-inline-start: 12px; }
  .qd-table tbody th { font-size: 13px; }
}

@media print {
  .qd { max-width: none; padding: 0; font-size: 12px; }
  .qd::before { display: none; }
  .qd-logo { height: 62px; }
  .qd-section { margin-top: 20px; }
  .qd-legal { break-before: page; }
}
