:root {
  --brand: #4b25df;
  --brand-dark: #3512b9;
  --ink: #111318;
  --muted: #5c6370;
  --line: #dfe2e8;
  --panel: #f5f6f8;
  --paper: #ffffff;
  --page-width: 210mm;
  --page-height: 297mm;
  --a4-width: var(--page-width);
  --a4-height: var(--page-height);
}

@font-face {
  font-family: "Poppins";
  src: url("assets/fonts/Poppins-Regular.ttf") format("truetype");
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}

@font-face {
  font-family: "Poppins";
  src: url("assets/fonts/Poppins-Bold.ttf") format("truetype");
  font-display: swap;
  font-style: normal;
  font-weight: 700;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background: #dfe2e7;
  color: var(--ink);
  font-family: "Avenir Next", "Inter", "Montserrat", Arial, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid #cfd3dc;
  border-radius: 6px;
  background: #ffffff;
  color: #161a22;
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  border-color: #aeb5c2;
}

button:disabled {
  cursor: wait;
  opacity: 0.74;
}

.button-loading::after {
  content: "";
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-left: 8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -2px;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  min-height: 100vh;
}

.editor-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 24px;
  background: var(--panel);
  border-right: 1px solid #cfd3dc;
}

.editor-heading {
  margin-bottom: 22px;
}

.eyebrow {
  display: block;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.editor-heading h1 {
  margin: 4px 0 0;
  font-size: 25px;
  line-height: 1.15;
}

.editor-section {
  padding: 18px 0;
  border-top: 1px solid #d8dce4;
}

.editor-section h2 {
  margin: 0 0 12px;
  font-size: 14px;
  text-transform: uppercase;
}

label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: #303743;
  font-size: 13px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid #cfd3dc;
  border-radius: 6px;
  background: #ffffff;
  color: #111318;
  padding: 9px 10px;
}

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

.two-up {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.json-editor {
  min-height: 220px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
}

.content-pages-editor {
  min-height: 320px;
}

.transcript-editor {
  min-height: 180px;
  font-size: 12px;
  line-height: 1.45;
}

.button-row + label {
  margin-top: 12px;
}

.button-row,
.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.editor-actions {
  position: sticky;
  bottom: 0;
  margin: 12px -24px -24px;
  padding: 16px 24px;
  background: rgba(245, 246, 248, 0.96);
  border-top: 1px solid #d8dce4;
}

.primary-button {
  flex: 1 1 170px;
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.status-message {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.preview-panel {
  min-width: 0;
  padding: 24px;
  overflow: auto;
}

.preview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: var(--page-width);
  margin: 0 auto 16px;
  color: #333844;
}

.proposal-document {
  display: grid;
  gap: 24px;
  justify-content: center;
}

.page {
  position: relative;
  width: var(--a4-width);
  height: var(--a4-height);
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 14px 38px rgba(20, 27, 37, 0.22);
  isolation: isolate;
  page-break-after: always;
}

.page:last-child {
  page-break-after: auto;
}

.measure-page {
  position: absolute;
  left: -10000px;
  top: 0;
  visibility: hidden;
  pointer-events: none;
  box-shadow: none;
}

.top-rule {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2.4500mm;
  background: #000000;
  z-index: 3;
}

.cover-page {
  text-align: center;
}

.cover-template,
.page-template {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 0;
}

.cover-hero {
  position: absolute;
  inset: 2.4500mm 0 auto;
  height: 178.0000mm;
  overflow: hidden;
  background: linear-gradient(135deg, #5d2cf2 0%, #4822de 54%, #5528ec 100%);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 73% 84%, 73% 99%, 0 72%);
}

.cover-wires {
  position: absolute;
  left: -4.0000mm;
  top: 0;
  width: 88.0000mm;
  height: 92.0000mm;
  opacity: 0.92;
}

.brand-shadow {
  position: absolute;
  right: -25.0000mm;
  top: 34.0000mm;
  color: rgba(255, 255, 255, 0.18);
  font-size: 28.0000mm;
  font-weight: 900;
  line-height: 0.78;
  text-align: left;
  transform: rotate(90deg);
  transform-origin: center;
  white-space: pre-line;
}

.cover-logo-wrap {
  position: absolute;
  right: 25.0000mm;
  top: 108.0000mm;
  width: 67.0000mm;
  height: 58.0000mm;
  z-index: 2;
}

.cover-logo-shadow {
  position: absolute;
  inset: 11.0000mm 0 -6.0000mm;
  background: var(--brand-dark);
  clip-path: polygon(50% 100%, 0 75%, 0 25%, 50% 0, 100% 25%, 100% 75%);
}

.cover-logo-hex {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #ffffff;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

.cover-logo-hex img {
  width: 31.0000mm;
  height: 31.0000mm;
  object-fit: contain;
}

.cover-title {
  position: absolute;
  left: 22.0000mm;
  right: 22.0000mm;
  top: 200.0000mm;
  z-index: 1;
}

.cover-kicker {
  margin: 0 0 3.0000mm;
  color: #25292f;
  font-family: "Roboto", "Arial", sans-serif;
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}

.cover-title h1 {
  margin: 0;
  color: var(--brand);
  font-family: "Poppins", "Avenir Next", Arial, sans-serif;
  font-size: 17.0000mm;
  font-weight: 700;
  line-height: 0.95;
  text-transform: uppercase;
}

.cover-title p:not(.cover-kicker) {
  max-width: 112.0000mm;
  margin: 7.0000mm auto 0;
  color: #15191f;
  font-size: 5.0000mm;
  line-height: 1.35;
}

.prepared-for {
  position: absolute;
  left: 20.0000mm;
  right: 20.0000mm;
  bottom: 7.0000mm;
  z-index: 1;
  color: #1e2431;
  font-family: "Canva Sans", "Poppins", "Avenir Next", Arial, sans-serif;
  font-size: 13.1px;
  font-weight: 700;
  letter-spacing: 2px;
  -webkit-text-stroke: 0.18px currentColor;
  text-shadow: 0.18px 0 0 currentColor;
  paint-order: stroke fill;
  text-transform: uppercase;
}

.page-inner {
  position: relative;
  z-index: 1;
  height: 100%;
  padding: 52.0000mm 17.3000mm 14.0000mm;
}

.page-header {
  display: flex;
  align-items: flex-start;
  gap: 11.0000mm;
  min-height: 25.0000mm;
}

.header-brand {
  display: grid;
  grid-template-columns: 16.0000mm 1fr;
  gap: 2.0000mm;
  width: 58.0000mm;
  align-items: center;
}

.header-brand img {
  width: 16.0000mm;
  height: 16.0000mm;
  object-fit: contain;
}

.header-brand strong {
  display: block;
  color: var(--brand);
  font-size: 3.1500mm;
  font-weight: 900;
  line-height: 1.1;
}

.header-brand span {
  display: block;
  color: #171a20;
  font-size: 2.7000mm;
  line-height: 1.12;
}

.header-line {
  flex: 1;
  height: 0.4500mm;
  margin-top: 5.8000mm;
  background: #171923;
}

.content-flow {
  margin-top: 0;
}

.content-page .section + .section,
.content-page .section + .table-section,
.content-page .table-section + .section {
  margin-top: 8.6000mm;
}

.content-page .section + .section.section-continuation {
  margin-top: 5.6000mm;
}

.content-page .section + .section.section-continuation.tight-continuation {
  margin-top: 0;
}

.section-title {
  margin: 0 0 5.0000mm;
  color: var(--brand);
  font-family: "Poppins", "Avenir Next", Arial, sans-serif;
  font-size: 17.4px;
  font-weight: 700;
  line-height: 1.05;
  text-transform: uppercase;
}

.section-title.compact {
  margin-bottom: 3.4000mm;
}

.section p,
.quote-note {
  margin: 0 0 6.3000mm;
  font-family: "Poppins", "Avenir Next", Arial, sans-serif;
  font-size: 12.4px;
  line-height: 1.42;
}

.section p:last-child {
  margin-bottom: 0;
}

.justify {
  text-align: justify;
}

.content-group {
  margin: 0 0 5.6000mm;
}

.content-group:last-child {
  margin-bottom: 0;
}

.content-group h3 {
  margin: 0 0 1.5000mm;
  color: #050609;
  font-family: "Poppins", "Avenir Next", Arial, sans-serif;
  font-size: 12.4px;
  font-weight: 700;
  line-height: 1.15;
}

.content-group ul {
  margin: 0;
  padding-left: 5.2000mm;
}

.content-group li {
  margin: 0.8500mm 0;
  font-size: 3.5500mm;
  line-height: 1.12;
}

.table-section {
  margin-top: 8.0000mm;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 3.3500mm;
}

.data-table th {
  background: var(--brand);
  color: #ffffff;
  font-family: "Canva Sans", "Poppins", "Avenir Next", Arial, sans-serif;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
}

.data-table th,
.data-table td {
  border: 0.2500mm solid var(--line);
  padding: 4.5000mm 3.4000mm;
  vertical-align: middle;
}

.timeline-table th,
.timeline-table td {
  padding: 4.0000mm 3.2000mm;
}

.timeline-table th:first-child,
.timeline-table td:first-child {
  width: 28%;
}

.quotation-content {
  margin-top: 0;
}

.quotation-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8.0000mm;
  margin: 16.0000mm 0 8.0000mm;
  font-size: 3.7500mm;
  line-height: 1.45;
}

.quotation-meta .right {
  justify-self: end;
  min-width: 48.0000mm;
}

.client-block {
  margin-bottom: 8.0000mm;
  font-size: 3.7500mm;
  line-height: 1.35;
}

.client-block strong {
  display: block;
  font-family: "Poppins", "Avenir Next", Arial, sans-serif;
  font-size: 14px;
  font-weight: 700;
}

.payment-table {
  margin-bottom: 11.0000mm;
  font-size: 3.7000mm;
}

.payment-table th,
.payment-table td {
  height: 17.0000mm;
}

.payment-table td:nth-child(2) {
  text-align: right;
}

.total-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  margin: 0 0 12.0000mm;
  color: var(--brand);
  font-family: "Poppins", "Avenir Next", Arial, sans-serif;
  font-size: 15.4px;
  font-weight: 700;
  text-transform: uppercase;
}

.total-row strong:last-child {
  color: #242935;
}

.total-row strong {
  font-weight: 700;
}

.quote-rule {
  height: 1.0000mm;
  margin: 0 0 5.8000mm;
  background: var(--brand);
}

.quote-note {
  font-size: 3.5000mm;
  font-style: italic;
  line-height: 1.28;
  text-align: left;
}

.acceptance {
  position: absolute;
  right: 17.3000mm;
  bottom: 29.0000mm;
  width: 72.0000mm;
  z-index: 1;
  text-align: center;
  font-size: 3.1500mm;
  line-height: 1.28;
}

.signature-line {
  display: block;
  height: 0.2500mm;
  margin-top: 16.0000mm;
  background: #111318;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .editor-panel {
    position: relative;
    height: auto;
  }

  .editor-actions {
    position: static;
    margin: 18px 0 0;
    padding: 0;
    border-top: 0;
  }

  .preview-panel {
    padding: 18px;
  }
}

@media (max-width: 820px) {
  .preview-panel {
    overflow-x: auto;
  }
}

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

@media print {
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  html,
  body {
    width: var(--a4-width);
    background: #ffffff;
  }

  .no-print {
    display: none !important;
  }

  .app-shell,
  .preview-panel,
  .proposal-document {
    display: block;
    width: var(--a4-width);
    padding: 0;
    margin: 0;
    background: #ffffff;
  }

  .page {
    width: var(--a4-width);
    height: var(--a4-height);
    margin: 0;
    box-shadow: none;
    break-after: page;
    page-break-after: always;
  }

  .page:last-child {
    break-after: auto;
    page-break-after: auto;
  }
}
