:root {
  --brand-primary: #930d23;
  --brand-primary-dark: #68101d;
  --brand-secondary: #a47a14;
  --green: #1f8a4c;
  --blue: #1e4f88;
  --ink: #17171a;
  --muted: #68676d;
  --line: #d8d5d2;
  --panel: #f4f1ed;
  --paper: #ffffff;
  --cream: #fff9e9;
  --rose: #fff1f2;
  --success: #effcf3;
  --shadow: 0 24px 70px rgba(27, 18, 14, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: #eae6e1;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  border-bottom: 1px solid rgba(104, 16, 29, 0.18);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.app-brand img {
  width: 150px;
  height: 46px;
  object-fit: contain;
}

.app-brand h1 {
  margin: 2px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  font-weight: 600;
}

.eyebrow,
.step-kicker {
  color: var(--brand-primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.source-status {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #4f4d4b;
  font-size: 13px;
  font-weight: 700;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #218c55;
  box-shadow: 0 0 0 5px rgba(33, 140, 85, 0.12);
}

.workspace {
  display: grid;
  min-height: calc(100vh - 76px);
  grid-template-columns: clamp(520px, 44vw, 680px) minmax(0, 1fr);
}

.intake-panel {
  min-width: 0;
  padding: 30px 34px 56px;
  border-right: 1px solid #d4cec7;
  background: #faf8f5;
}

.panel-heading {
  margin-bottom: 28px;
}

.panel-heading h2 {
  margin: 7px 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  font-weight: 600;
}

.panel-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.form-section {
  display: grid;
  gap: 17px;
  margin-bottom: 30px;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
  color: var(--brand-primary-dark);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-label span {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-primary);
  color: white;
}

.field {
  display: grid;
  gap: 7px;
}

.field > span {
  color: #363337;
  font-size: 12px;
  font-weight: 780;
}

.field b {
  color: var(--brand-primary);
}

.field small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.unit-value-assistance {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.unit-value-assistance small {
  min-width: 260px;
  flex: 1;
  overflow-wrap: anywhere;
}

.unit-value-assistance code {
  color: #5d5551;
  font-family: inherit;
  font-size: inherit;
  overflow-wrap: anywhere;
}

.inline-action {
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: var(--brand-primary);
  font-size: 11px;
  font-weight: 800;
}

.knowledge-freshness {
  display: grid;
  gap: 5px;
  padding: 12px 13px;
  border: 1px solid #d5cec6;
  border-radius: 7px;
  background: #fff;
  color: #665f5a;
  font-size: 11px;
  line-height: 1.45;
}

.knowledge-freshness strong {
  color: var(--brand-primary-dark);
  font-size: 12px;
}

.field-row {
  display: grid;
  align-items: start;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}

.field-row-currency {
  grid-template-columns: minmax(130px, 0.35fr) minmax(320px, 1fr);
}

.field-row-payment {
  grid-template-columns: minmax(300px, 1.25fr) minmax(180px, 0.75fr);
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #ccc6c0;
  border-radius: 7px;
  outline: none;
  background: white;
  color: var(--ink);
  font-size: 13px;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

input,
select {
  min-height: 42px;
  padding: 0 11px;
}

textarea {
  min-height: 84px;
  resize: vertical;
  padding: 10px 11px;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(147, 13, 35, 0.1);
}

select:disabled {
  cursor: not-allowed;
  background: #efedeb;
  color: #8b8784;
}

.input-prefix,
.input-suffix {
  display: flex;
  overflow: hidden;
  align-items: center;
  border: 1px solid #ccc6c0;
  border-radius: 7px;
  background: white;
}

.input-prefix:focus-within,
.input-suffix:focus-within {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(147, 13, 35, 0.1);
}

.input-prefix input,
.input-suffix input {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.input-prefix > span,
.input-suffix > span {
  padding: 0 11px;
  color: #746f6b;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.input-prefix > span {
  border-right: 1px solid #e1dcd7;
}

.input-suffix > span {
  border-left: 1px solid #e1dcd7;
}

.dynamic-fields {
  display: grid;
  gap: 17px;
}

.rule-callout {
  display: grid;
  gap: 5px;
  padding: 12px 13px;
  border-left: 3px solid var(--brand-secondary);
  background: #f2ede5;
  font-size: 12px;
  line-height: 1.45;
}

.rule-callout strong {
  color: var(--brand-primary-dark);
}

.is-hidden {
  display: none !important;
}

.validation-summary {
  margin-bottom: 18px;
  padding: 14px 15px;
  border: 1px solid #d98993;
  border-radius: 8px;
  background: #fff0f2;
  color: #791021;
  font-size: 12px;
  line-height: 1.5;
}

.validation-summary ul {
  margin: 7px 0 0;
  padding-left: 19px;
}

.form-actions,
.toolbar-actions {
  display: flex;
  gap: 10px;
}

.button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 800;
  transition:
    transform 0.15s ease,
    background 0.15s ease,
    opacity 0.15s ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.button-primary {
  flex: 1;
  background: var(--brand-primary);
  color: white;
}

.button-primary:hover {
  background: var(--brand-primary-dark);
}

.button-dark {
  background: #211c1d;
  color: white;
}

.button-ghost {
  border-color: #cfc8c1;
  background: white;
  color: #4a4542;
}

.preview-panel {
  min-width: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(147, 13, 35, 0.06), transparent 32%),
    #eae6e1;
}

.preview-toolbar {
  position: sticky;
  z-index: 10;
  top: 76px;
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  padding: 13px 28px;
  border-bottom: 1px solid #d4cec7;
  background: rgba(244, 241, 237, 0.94);
  backdrop-filter: blur(12px);
}

.preview-toolbar strong {
  display: block;
  margin-top: 4px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
}

.preview-viewport {
  overflow-x: auto;
  min-height: calc(100vh - 146px);
  padding: 38px;
}

.empty-state {
  max-width: 540px;
  margin: 13vh auto 0;
  text-align: center;
}

.empty-mark {
  display: grid;
  width: 78px;
  height: 78px;
  margin: 0 auto 22px;
  place-items: center;
  border: 1px solid rgba(147, 13, 35, 0.25);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  color: var(--brand-primary);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  font-style: italic;
}

.empty-state h2 {
  margin: 0 0 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 32px;
  font-weight: 500;
}

.empty-state p {
  margin: 0 auto;
  color: #69645f;
  line-height: 1.6;
}

.empty-state ul {
  display: inline-grid;
  gap: 8px;
  margin: 25px auto 0;
  padding: 0;
  color: #5a5551;
  font-size: 13px;
  list-style: none;
  text-align: left;
}

.empty-state li::before {
  margin-right: 9px;
  color: var(--green);
  content: "✓";
  font-weight: 900;
}

.quote-document {
  width: 794px;
  margin: 0 auto;
}

.paper {
  position: relative;
  width: 794px;
  min-height: 1123px;
  margin: 0 auto 30px;
  padding: 62px 62px 78px;
  background: var(--paper);
  box-shadow: var(--shadow);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  line-height: 1.25;
}

.paper-page-one {
  padding-top: 52px;
}

.quote-header {
  display: grid;
  height: 94px;
  align-items: center;
  padding: 12px 16px;
  background: var(--brand-primary);
  color: white;
  grid-template-columns: 190px 1fr 110px;
}

.quote-logo {
  display: flex;
  height: 62px;
  align-items: center;
  padding: 5px;
  background: white;
}

.quote-logo img {
  width: 100%;
  max-height: 52px;
  object-fit: contain;
}

.quote-title {
  padding-left: 18px;
}

.quote-title h1 {
  margin: 0;
  color: #b28a1e;
  font-size: 22px;
  line-height: 1;
}

.quote-title p {
  margin: 5px 0 0;
  font-size: 11px;
}

.quote-title p span {
  margin: 0 5px;
}

.experience-badge {
  text-align: right;
}

.experience-badge strong {
  display: block;
  color: #b28a1e;
  font-size: 29px;
  line-height: 1;
}

.experience-badge span {
  font-size: 10px;
  line-height: 1.1;
}

.confidential-intro {
  margin: 35px 0 8px;
  color: #6b6767;
  font-size: 12px;
  font-style: italic;
}

.client-strip {
  display: grid;
  padding: 10px 12px;
  border: 1px solid #c9c7c5;
  background: #fafafa;
  grid-template-columns: 1.5fr 0.7fr;
  gap: 5px 15px;
}

.client-strip > div:last-child {
  grid-column: 1 / -1;
}

.client-strip span {
  color: var(--brand-primary);
}

.document-section-heading {
  display: grid;
  height: 35px;
  align-items: center;
  margin-top: 26px;
  background: var(--brand-primary);
  color: white;
  grid-template-columns: 52px 1fr;
}

.document-section-heading b {
  display: grid;
  height: 100%;
  place-items: center;
  background: var(--brand-secondary);
  font-size: 20px;
}

.document-section-heading span {
  padding-left: 12px;
  font-size: 15px;
  font-weight: 800;
}

.paper > p {
  margin: 20px 0;
}

.amount-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.amount-card {
  display: flex;
  min-height: 98px;
  flex-direction: column;
  justify-content: center;
  padding: 12px 14px;
  border: 1px solid currentColor;
}

.amount-card > span {
  color: #625f60;
  font-size: 12px;
}

.amount-card > strong {
  margin-top: 5px;
  font-size: 28px;
  line-height: 1;
}

.amount-card > small {
  margin-top: 3px;
  color: #686466;
  font-size: 10px;
  font-weight: 800;
}

.amount-card > em {
  margin-top: 6px;
  color: #686466;
  font-size: 10px;
}

.amount-card-primary {
  background: var(--rose);
  color: var(--brand-primary);
}

.amount-card-gold {
  background: var(--cream);
  color: var(--brand-secondary);
}

.document-note {
  margin: 20px 0 25px;
  padding: 8px 10px;
  border: 1px solid var(--brand-secondary);
  background: var(--cream);
  color: #635f5a;
  font-size: 10px;
  font-style: italic;
}

.document-note b {
  color: #7f5f0a;
}

.scenario-heading {
  margin: 0 0 13px;
  padding-left: 10px;
  border-left: 3px solid var(--green);
  color: var(--green);
  font-size: 14px;
  font-weight: 800;
}

.amount-card-success {
  background: var(--success);
  color: var(--green);
}

.payment-option {
  margin-top: 17px;
  border: 1px solid #b9b6b4;
}

.payment-option-heading {
  padding: 8px 11px;
  background: var(--brand-primary);
  color: white;
  font-size: 13px;
  font-weight: 800;
}

.payment-option-heading span {
  color: #c49b2d;
}

.payment-row {
  display: grid;
  min-height: 34px;
  align-items: center;
  padding: 7px 11px;
  border-top: 1px solid #d2cfcc;
  background: #fff7f7;
  grid-template-columns: 1fr auto auto;
  gap: 9px;
}

.payment-row > strong {
  color: var(--brand-primary);
  font-size: 17px;
}

.payment-row > small {
  color: #6c6868;
  font-size: 9px;
}

.payment-row p {
  max-width: 440px;
  margin: 0;
  text-align: right;
}

.payment-total {
  background: #fce9eb;
  font-weight: 800;
}

.financed .payment-option-heading {
  background: var(--blue);
}

.financed .payment-row {
  background: #f0f6fd;
}

.financed-continuation {
  margin-top: 0;
  margin-bottom: 28px;
  border-top: 3px solid var(--blue);
}

.table-title,
.conditions-title {
  margin: 0 0 9px;
  color: var(--brand-primary);
  font-size: 15px;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.summary-table th {
  padding: 8px 9px;
  background: var(--brand-primary);
  color: white;
  text-align: left;
}

.summary-table td {
  padding: 7px 9px;
  border: 1px solid #c8c5c2;
}

.summary-table tr:nth-child(even) {
  background: #fafafa;
}

.summary-table td:nth-child(2) {
  color: var(--brand-primary);
  font-weight: 800;
  white-space: nowrap;
}

.summary-table td:nth-child(3) {
  color: #686466;
  font-style: italic;
}

.conditions-title {
  margin-top: 30px;
}

.conditions-list {
  margin: 0;
  padding-left: 19px;
  font-size: 11px;
  line-height: 1.45;
}

.conditions-list li {
  padding-left: 3px;
}

.conditions-list li::marker {
  color: var(--brand-secondary);
  font-weight: 800;
}

.acceptance-block {
  margin-top: 28px;
  padding: 14px 16px 19px;
  border: 1px solid var(--brand-secondary);
}

.acceptance-block h2 {
  margin: 0 0 24px;
  color: var(--brand-primary);
  font-size: 15px;
  text-align: center;
}

.acceptance-grid {
  display: grid;
  color: #5f5b5b;
  font-size: 10px;
  grid-template-columns: 1fr 1.2fr;
  gap: 25px;
}

.acceptance-grid > div {
  display: grid;
  align-content: start;
  gap: 7px;
}

.signature-line {
  height: 30px;
  border-bottom: 1px solid #b7b3b0;
}

.confidentiality-block {
  margin-top: 25px;
  padding: 9px 10px;
  border: 1px solid var(--brand-primary);
  border-left-width: 4px;
  background: #fff3f4;
  color: var(--brand-primary);
  font-size: 10px;
}

.document-footer {
  position: absolute;
  right: 62px;
  bottom: 38px;
  left: 62px;
  padding-top: 6px;
  border-top: 1px solid #bcb9b7;
  color: #6c6866;
  font-size: 8px;
  text-align: center;
}

.internal-note {
  margin: 0 auto 50px;
  padding: 22px 24px;
  border: 1px solid #d1cbc5;
  border-left: 5px solid #2b2828;
  background: white;
  box-shadow: 0 12px 35px rgba(27, 18, 14, 0.08);
  font-size: 12px;
  line-height: 1.5;
}

.internal-note > span {
  color: var(--brand-primary);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.internal-note h3 {
  margin: 8px 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
}

.internal-note p {
  margin: 6px 0;
}

.internal-note ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

@media (max-width: 1050px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .intake-panel {
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid #d4cec7;
  }

  .preview-toolbar {
    top: 76px;
  }
}

@media (max-width: 720px) {
  .app-header {
    position: static;
    padding: 12px 16px;
  }

  .app-brand img {
    width: 110px;
  }

  .app-brand h1 {
    font-size: 17px;
  }

  .source-status {
    display: none;
  }

  .intake-panel {
    padding: 25px 18px 40px;
  }

  .field-row,
  .field-row-currency,
  .field-row-payment {
    grid-template-columns: 1fr;
  }

  .preview-toolbar {
    position: static;
    align-items: flex-start;
    padding: 14px 18px;
  }

  .toolbar-actions {
    flex-direction: column;
  }

  .preview-viewport {
    padding: 18px 8px;
  }

  .quote-document {
    transform-origin: top left;
  }
}

@page {
  size: A4;
  margin: 0;
}

@media print {
  body {
    background: white;
  }

  .app-header,
  .intake-panel,
  .preview-toolbar,
  .empty-state,
  .internal-note {
    display: none !important;
  }

  .workspace,
  .preview-panel,
  .preview-viewport,
  #documentRoot,
  .quote-document {
    display: block;
    width: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    background: white;
  }

  .paper {
    width: 210mm;
    min-height: 297mm;
    margin: 0;
    padding: 16.4mm 16.4mm 20.6mm;
    break-after: page;
    box-shadow: none;
  }

  .paper:last-of-type {
    break-after: auto;
  }

  .document-footer {
    right: 16.4mm;
    bottom: 10mm;
    left: 16.4mm;
  }

  .demo-config-trigger,
  .demo-config-overlay {
    display: none !important;
  }
}

/* Demo configuration modal */
.demo-config-trigger {
  font-size: 11px;
  min-height: 34px;
  padding: 0 13px;
}

.demo-config-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
}

.demo-config-overlay[hidden] {
  display: none !important;
}

.demo-config-modal {
  width: min(480px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 12px;
  background: white;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.22);
}

.demo-config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e8e4e0;
  font-size: 14px;
  font-weight: 800;
}

.demo-config-close {
  padding: 4px 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
}

.demo-config-step {
  display: grid;
  gap: 16px;
  padding: 24px 20px;
}

.demo-config-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.demo-config-fields {
  display: grid;
  gap: 14px;
}

.demo-config-colors {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}

.demo-config-colors input[type="color"] {
  min-height: 42px;
  padding: 4px 6px;
  cursor: pointer;
}

.demo-config-actions {
  display: flex;
  gap: 10px;
}

.demo-config-error {
  padding: 8px 10px;
  border-radius: 6px;
  background: #fff0f2;
  color: #791021;
  font-size: 12px;
}
