:root {
  --broker-orange: #f26a21;
  --broker-violet: #6f2dbd;
  --ink: #111111;
  --muted: #66616b;
  --line: #e8e3ee;
  --surface: #ffffff;
  --soft: #f7f5fa;
  --dark: #17121f;
  --shadow: 0 24px 70px rgba(17, 17, 17, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--soft);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(242, 106, 33, 0.13), transparent 34%),
    linear-gradient(315deg, rgba(111, 45, 189, 0.13), transparent 38%),
    var(--soft);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(18px, 4vw, 56px);
  color: #ffffff;
  background: var(--dark);
}

.brand-mark {
  font-weight: 800;
  letter-spacing: 0;
  padding: 8px 12px;
  color: #ffffff;
  background: linear-gradient(90deg, var(--broker-orange), var(--broker-violet));
  border-radius: 6px;
}

.topbar-title {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.82);
}

.workspace {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(28px, 5vw, 58px) 0 44px;
}

.intro {
  max-width: 780px;
  margin-bottom: 26px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--broker-orange);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 780px;
  margin-bottom: 10px;
  font-size: clamp(2.1rem, 5vw, 4rem);
  line-height: 1;
  letter-spacing: 0;
}

.lede {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.calculator-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.86fr) minmax(340px, 1.14fr);
  gap: 18px;
  align-items: stretch;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.input-panel {
  display: grid;
  gap: 22px;
  align-content: start;
  padding: clamp(20px, 3vw, 30px);
}

.field-group {
  display: grid;
  gap: 9px;
}

label {
  font-size: 0.9rem;
  font-weight: 800;
}

select,
input {
  width: 100%;
  min-height: 54px;
  border: 1px solid #d9d1e6;
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

select {
  padding: 0 44px 0 14px;
}

input {
  padding: 0 54px 0 14px;
}

select:focus,
input:focus {
  border-color: var(--broker-violet);
  box-shadow: 0 0 0 4px rgba(111, 45, 189, 0.14);
}

.input-with-unit {
  position: relative;
}

.input-with-unit span {
  position: absolute;
  right: 14px;
  top: 50%;
  color: var(--muted);
  font-weight: 700;
  transform: translateY(-50%);
}

.field-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.price-editor,
.shipping-editor {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.mini-heading span {
  display: block;
  margin-bottom: 4px;
  color: var(--broker-orange);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.mini-heading h2 {
  margin: 0;
  font-size: 1.05rem;
}

.price-fields {
  display: grid;
  gap: 10px;
}

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

.price-field span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.money-input {
  position: relative;
}

.money-input > span {
  position: absolute;
  left: 12px;
  top: 50%;
  color: var(--muted);
  font-weight: 800;
  transform: translateY(-50%);
}

.money-input input {
  min-height: 46px;
  padding-left: 30px;
}

.autosave-message {
  margin: 0;
  color: var(--broker-violet);
  font-size: 0.82rem;
  font-weight: 800;
}

.future-actions {
  padding-top: 4px;
}

.future-actions > span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  text-transform: uppercase;
}

.future-action-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.future-action-list button {
  min-height: 42px;
  border: 1px dashed #cfc4dd;
  border-radius: 6px;
  color: #7d7488;
  background: #faf8fc;
}

.pdf-button {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  background: linear-gradient(90deg, var(--broker-orange), var(--broker-violet));
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(111, 45, 189, 0.22);
}

.pdf-button:hover {
  filter: brightness(1.04);
}

.quote-toggle-button {
  width: 100%;
  min-height: 50px;
  border: 1px solid rgba(111, 45, 189, 0.34);
  border-radius: 6px;
  color: var(--broker-violet);
  background: #ffffff;
  font-weight: 800;
  cursor: pointer;
}

.quote-toggle-button:hover {
  border-color: var(--broker-violet);
  background: rgba(111, 45, 189, 0.07);
}

.result-panel {
  padding: clamp(20px, 3vw, 30px);
}

.result-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.result-heading h2 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2.1rem);
  line-height: 1.16;
}

.status-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 7px 10px;
  color: #ffffff;
  background: var(--broker-violet);
  font-size: 0.78rem;
  font-weight: 800;
}

.summary-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}

.summary-metrics div {
  min-height: 92px;
  padding: 14px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--dark);
}

.summary-metrics div:nth-child(2) {
  background: var(--broker-orange);
}

.summary-metrics div:nth-child(3) {
  background: var(--broker-violet);
}

.summary-metrics span {
  display: block;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.78rem;
  font-weight: 700;
}

.summary-metrics strong {
  display: block;
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  line-height: 1.1;
}

.recommended-block {
  margin-bottom: 20px;
  padding: 18px;
  border: 1px solid rgba(242, 106, 33, 0.28);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(242, 106, 33, 0.13), rgba(111, 45, 189, 0.09));
}

.recommended-block h3 {
  margin-bottom: 12px;
}

.recommended-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.recommended-list li {
  position: relative;
  padding-left: 18px;
  font-size: 1.05rem;
  font-weight: 800;
}

.recommended-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--broker-orange);
}

.result-block {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.result-block + .result-block {
  margin-top: 18px;
}

.result-block h3,
.section-heading h2 {
  margin-bottom: 12px;
}

.package-list,
.performance-list,
.cost-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.package-list li,
.performance-list li,
.cost-list li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.package-list strong,
.performance-list strong,
.cost-list strong {
  color: var(--broker-violet);
}

.cost-list div {
  display: grid;
  gap: 4px;
}

.cost-list small {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.cost-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  padding: 16px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--dark);
}

.cost-total span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.88rem;
  font-weight: 800;
}

.cost-total strong {
  font-size: 1.35rem;
}

.payment-options {
  display: grid;
  gap: 10px;
}

.shipping-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.shipping-summary div {
  min-height: 92px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.shipping-summary div:nth-child(3) {
  color: #ffffff;
  background: var(--dark);
}

.shipping-summary span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.shipping-summary div:nth-child(3) span {
  color: rgba(255, 255, 255, 0.76);
}

.shipping-summary strong {
  display: block;
  color: var(--broker-violet);
  font-size: 1.25rem;
  line-height: 1.15;
}

.shipping-summary div:nth-child(3) strong {
  color: #ffffff;
}

.shipping-note {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-left: 4px solid var(--broker-orange);
  border-radius: 6px;
  color: var(--muted);
  background: rgba(242, 106, 33, 0.09);
  font-size: 0.86rem;
  line-height: 1.5;
}

.payment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.payment-row span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.payment-row strong {
  text-align: right;
  font-size: 1.05rem;
}

.featured-installments {
  border-color: rgba(242, 106, 33, 0.34);
  background: rgba(242, 106, 33, 0.11);
}

.featured-installments strong {
  color: var(--broker-orange);
}

.featured-transfer {
  border-color: rgba(111, 45, 189, 0.28);
  background: rgba(111, 45, 189, 0.09);
}

.featured-transfer strong {
  color: var(--broker-violet);
}

.featured-saving {
  border-color: rgba(35, 134, 54, 0.3);
  background: rgba(35, 134, 54, 0.1);
}

.featured-saving strong {
  color: #238636;
}

.quote-panel[hidden] {
  display: none;
}

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

.client-form textarea {
  width: 100%;
  min-height: 104px;
  resize: vertical;
  border: 1px solid #d9d1e6;
  border-radius: 6px;
  padding: 12px 14px;
  color: var(--ink);
  background: #ffffff;
  outline: none;
}

.client-form textarea:focus {
  border-color: var(--broker-violet);
  box-shadow: 0 0 0 4px rgba(111, 45, 189, 0.14);
}

.full-field {
  grid-column: 1 / -1;
}

.quote-summary {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.quote-summary h4 {
  margin: 0;
  font-size: 1rem;
}

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

.quote-summary-grid div,
.quote-materials {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.quote-summary-grid span,
.quote-materials > span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.quote-summary-grid strong {
  display: block;
  font-size: 1.02rem;
}

.quote-total-general {
  color: #ffffff;
  background: var(--dark) !important;
}

.quote-total-general span {
  color: rgba(255, 255, 255, 0.76);
}

.quote-saving {
  border-color: rgba(35, 134, 54, 0.3) !important;
  background: rgba(35, 134, 54, 0.1) !important;
}

.quote-saving strong {
  color: #238636;
}

.quote-materials ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  font-weight: 800;
}

.products-section {
  margin-top: 34px;
}

.section-heading {
  margin-bottom: 14px;
}

.section-heading h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
}

.product-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.product-card {
  min-height: 154px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.product-card h3 {
  margin-bottom: 10px;
  font-size: 1rem;
  line-height: 1.25;
}

.product-card p {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.product-card strong {
  color: var(--ink);
}

.technical-note {
  margin: 20px 0 0;
  padding: 14px 16px;
  border-left: 4px solid var(--broker-violet);
  border-radius: 6px;
  color: var(--muted);
  background: #faf8fc;
  font-size: 0.9rem;
  line-height: 1.55;
}

.pdf-document {
  display: none;
}

@media (max-width: 860px) {
  .calculator-grid,
  .product-cards {
    grid-template-columns: 1fr;
  }

  .summary-metrics {
    grid-template-columns: 1fr;
  }

  .shipping-summary {
    grid-template-columns: 1fr;
  }

  .client-form,
  .quote-summary-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace {
    width: min(100% - 24px, 1180px);
    padding-top: 24px;
  }

  h1 {
    font-size: 2.35rem;
  }

  .future-action-list {
    grid-template-columns: 1fr;
  }

  .package-list li,
  .performance-list li,
  .cost-list li,
  .cost-total,
  .payment-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .payment-row strong {
    text-align: left;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 12mm;
  }

  html,
  body {
    width: 210mm;
    min-height: 297mm;
    background: #ffffff;
  }

  .app-shell {
    display: none;
  }

  .pdf-document {
    display: block;
    color: #111111;
    background: #ffffff;
  }

  .pdf-page {
    width: 100%;
    min-height: 273mm;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #111111;
  }

  .pdf-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 10mm;
    padding: 9mm;
    border-radius: 4mm;
    color: #ffffff;
    background: #17121f;
  }

  .pdf-brand {
    display: inline-block;
    margin-bottom: 5mm;
    padding: 3mm 4mm;
    border-radius: 2mm;
    background: linear-gradient(90deg, #f26a21, #6f2dbd);
    font-size: 16pt;
    font-weight: 800;
  }

  .pdf-header h1 {
    margin: 0 0 2mm;
    color: #ffffff;
    font-size: 24pt;
    line-height: 1.1;
  }

  .pdf-header p {
    margin: 0;
    color: rgba(255, 255, 255, 0.82);
    font-size: 11pt;
    font-weight: 700;
  }

  .pdf-section {
    margin-bottom: 6mm;
    page-break-inside: avoid;
  }

  .pdf-section h2 {
    margin: 0 0 3mm;
    color: #6f2dbd;
    font-size: 13pt;
  }

  .pdf-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3mm;
  }

  .pdf-grid > div,
  .pdf-recommended,
  .pdf-note {
    padding: 4mm;
    border: 0.3mm solid #e8e3ee;
    border-radius: 3mm;
    background: #ffffff;
  }

  .pdf-grid span {
    display: block;
    margin-bottom: 2mm;
    color: #66616b;
    font-size: 8.5pt;
    font-weight: 800;
  }

  .pdf-grid strong {
    font-size: 12pt;
  }

  .pdf-recommended {
    border-color: rgba(242, 106, 33, 0.45);
    background: rgba(242, 106, 33, 0.08);
  }

  .pdf-recommended ul {
    margin: 0;
    padding-left: 5mm;
    font-size: 12pt;
    font-weight: 800;
  }

  .pdf-recommended li + li {
    margin-top: 2mm;
  }

  .pdf-section table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
    border: 0.3mm solid #e8e3ee;
    border-radius: 3mm;
    font-size: 10pt;
  }

  .pdf-section th,
  .pdf-section td {
    padding: 3mm;
    border-bottom: 0.3mm solid #e8e3ee;
    text-align: left;
  }

  .pdf-section th {
    color: #ffffff;
    background: #17121f;
    font-size: 8.5pt;
    text-transform: uppercase;
  }

  .pdf-highlight-orange {
    border-color: rgba(242, 106, 33, 0.5) !important;
    background: rgba(242, 106, 33, 0.1) !important;
  }

  .pdf-highlight-violet {
    border-color: rgba(111, 45, 189, 0.42) !important;
    background: rgba(111, 45, 189, 0.09) !important;
  }

  .pdf-highlight-green {
    border-color: rgba(35, 134, 54, 0.4) !important;
    background: rgba(35, 134, 54, 0.1) !important;
  }

  .pdf-highlight-green strong {
    color: #238636;
  }

  .pdf-note p {
    margin: 0;
    color: #66616b;
    font-size: 9.5pt;
    line-height: 1.5;
  }

  .pdf-footer {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 4mm;
    align-items: center;
    margin-top: 8mm;
    padding: 5mm;
    border-radius: 3mm;
    color: #ffffff;
    background: #17121f;
    font-size: 9.5pt;
  }

  .pdf-footer strong {
    color: #ffffff;
  }
}
