:root {
  color-scheme: light;
  --brand-blue: #24273d;
  --brand-blue-dark: #1e2030;
  --brand-blue-soft: #4c5369;
  --brand-red: #da0c35;
  --brand-red-dark: #b31634;
  --ice: #eaf1f5;
  --ice-strong: #d1d6e0;
  --ink: var(--brand-blue);
  --muted: #68798a;
  --line: #d1d6e0;
  --surface: #ffffff;
  --soft: #f5f7fa;
  --accent: var(--brand-red);
  --accent-strong: var(--brand-red-dark);
  --shadow: 0 14px 34px rgba(38, 47, 58, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(234, 241, 245, 0.96), rgba(255, 255, 255, 0) 34rem),
    var(--soft);
  color: var(--ink);
  font-family:
    Omnes, "Trebuchet MS", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 22px 0 30px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 0.78rem;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
  font-family: "Bree Serif", Georgia, "Times New Roman", serif;
}

h1 {
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
}

h2 {
  font-size: 1.08rem;
}

.intro {
  max-width: 620px;
  margin: 12px 0 0;
  color: var(--brand-blue-soft);
  font-size: 1.02rem;
  font-weight: 700;
}

.brand-logo {
  width: min(210px, 32vw);
  min-width: 150px;
  height: auto;
  background: white;
  border: 1px solid var(--ice-strong);
  border-radius: 8px;
  padding: 12px;
  box-shadow: var(--shadow);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.panel,
.service-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 0 rgba(32, 33, 36, 0.03);
}

.quote-form,
.controls,
.totals,
.quote-preview {
  padding: 20px;
}

.summary-panel {
  display: grid;
  gap: 18px;
  position: sticky;
  top: 18px;
}

.section-heading,
.with-action,
.service-head,
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

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

.with-action {
  margin-top: 24px;
}

.grid {
  display: grid;
  gap: 14px;
}

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

.three {
  grid-template-columns: 1fr 1fr 1fr;
}

.four {
  grid-template-columns: 1fr 1fr 1fr 1fr;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  min-height: 42px;
  padding: 9px 11px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--brand-blue-soft);
  box-shadow: 0 0 0 3px rgba(76, 83, 105, 0.18);
}

.items {
  display: grid;
  gap: 14px;
}

.service-card {
  padding: 16px;
}

.service-head {
  margin-bottom: 14px;
}

.service-head label {
  flex: 1;
}

.rights-row {
  display: grid;
  grid-template-columns: 1fr 132px;
  gap: 14px;
  align-items: end;
  margin-top: 14px;
}

.checkbox-line {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
}

.checkbox-line input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.input-suffix {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

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

.input-suffix span {
  padding: 0 11px;
  color: var(--muted);
  font-weight: 800;
}

.compact input {
  min-width: 0;
}

.service-result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.service-note {
  color: var(--muted);
  font-size: 0.88rem;
}

.line-total {
  font-size: 1.08rem;
  color: var(--brand-blue);
}

.ghost-button,
.primary-button,
.icon-button {
  border: 0;
  cursor: pointer;
  min-height: 40px;
  border-radius: 6px;
  font-weight: 850;
}

.ghost-button {
  background: var(--brand-red);
  color: #fff;
  padding: 0 14px;
  box-shadow: 0 8px 18px rgba(218, 12, 53, 0.22);
}

.primary-button {
  width: 100%;
  margin-top: 16px;
  background: var(--brand-red);
  color: white;
}

.primary-button:hover,
.ghost-button:hover {
  filter: brightness(0.96);
}

.icon-button {
  width: 40px;
  background: #fbe7eb;
  color: var(--brand-red);
  font-size: 1.4rem;
  line-height: 1;
}

.controls {
  display: grid;
  gap: 13px;
  max-height: none;
}

.controls h2,
.totals h2 {
  margin-bottom: 2px;
}

dl {
  margin: 14px 0 0;
}

dl div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

dt {
  color: var(--muted);
  font-weight: 750;
}

dd {
  margin: 0;
  font-weight: 850;
}

.grand-total {
  border-bottom: 0;
  align-items: end;
}

.grand-total dd {
  color: var(--brand-red);
  font-size: 1.55rem;
}

.quote-preview {
  margin-top: 18px;
  padding: 0;
  overflow: hidden;
}

.quote-page {
  width: min(100%, 900px);
  min-height: 1120px;
  margin: 0 auto;
  padding: 0 38px 18px;
  background: #fff;
  border: 1px solid #1e2030;
  color: #050505;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.88rem;
  line-height: 1.18;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.quote-top-strip {
  height: 22px;
  margin: 0 -38px 28px;
  background: var(--brand-blue);
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.modern-header {
  margin-bottom: 30px;
  color: #666;
}

.modern-header h2 {
  margin: 0 0 10px;
  color: var(--brand-red);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.8rem;
  line-height: 1.05;
}

.modern-header p,
.modern-grid p,
.modern-notes p,
.modern-signature p {
  margin: 0;
}

.modern-title {
  margin: 0 0 28px;
  color: var(--brand-blue-dark);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 2.8rem;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0;
}

.modern-grid {
  display: grid;
  gap: 18px 54px;
  margin-bottom: 24px;
}

.three-columns,
.client-grid {
  grid-template-columns: 1.15fr 1fr 1fr;
}

.modern-grid h3,
.modern-notes h3 {
  margin: 0 0 7px;
  color: #050505;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1rem;
  line-height: 1.05;
  font-weight: 900;
}

.client-grid {
  border-top: 1px solid #aaa;
  border-bottom: 1px solid #aaa;
  padding: 24px 0;
}

.inline-subtitle {
  margin-top: 28px !important;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

td:last-child,
th:last-child {
  text-align: right;
}

.modern-items {
  margin-bottom: 18px;
}

.modern-items table {
  width: 100%;
  table-layout: fixed;
  font-size: 0.92rem;
}

.modern-items th,
.modern-items td {
  border: 0;
  padding: 4px 6px;
}

.modern-items th {
  color: #273986;
  font-size: 1rem;
  font-weight: 900;
  text-align: left;
  text-transform: none;
}

.modern-items th:nth-child(1),
.modern-items td:nth-child(1) {
  width: 74%;
}

.modern-items th:nth-child(2),
.modern-items td:nth-child(2) {
  width: 8%;
  text-align: right;
}

.modern-items th:nth-child(3),
.modern-items td:nth-child(3) {
  width: 18%;
  text-align: right;
}

.modern-items tbody tr:nth-child(even) {
  background: #f1f1f1;
}

.modern-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 28px;
  border-top: 1px solid #aaa;
  padding-top: 10px;
  margin-bottom: 34px;
}

.modern-notes {
  font-size: 0.82rem;
}

.modern-totals {
  display: grid;
  gap: 14px;
  color: #596171;
  font-size: 1rem;
}

.modern-totals div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.modern-totals strong {
  color: #050505;
}

.modern-totals p {
  margin: 10px 0 0;
  color: #8e172f;
  font-size: 2rem;
  font-weight: 900;
  text-align: right;
}

.modern-signature {
  width: 420px;
  margin-bottom: 4px;
  color: #555;
}

.modern-signature div {
  width: 360px;
  border-top: 1px solid #050505;
  margin-bottom: 5px;
}

.modern-signature p:first-of-type {
  font-size: 1rem;
  font-weight: 900;
}

.modern-footer {
  margin-top: 4px;
  border-top: 1px dashed #bbb;
  color: #888;
  font-size: 0.78rem;
  text-align: center;
}

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

  .summary-panel {
    position: static;
  }
}

@media (max-width: 680px) {
  .shell {
    width: min(100% - 22px, 1180px);
    padding-top: 16px;
  }

  .topbar {
    align-items: flex-start;
  }

  .brand-logo {
    width: 150px;
    min-width: 150px;
    padding: 12px;
  }

  .two,
  .three,
  .four,
  .rights-row,
  .admin-row {
    grid-template-columns: 1fr;
  }

  .preview-header,
  .service-result {
    align-items: flex-start;
    flex-direction: column;
  }

  .quote-page {
    min-height: auto;
    padding: 0 16px 18px;
    font-size: 0.82rem;
  }

  .quote-top-strip {
    margin-inline: -16px;
  }

  .modern-title {
    font-size: 2rem;
  }

  .three-columns,
  .client-grid,
  .modern-bottom {
    grid-template-columns: 1fr;
  }

  .modern-signature {
    width: 100%;
  }
}

@media print {
  body {
    background: #fff;
  }

  .quote-form,
  .summary-panel,
  .topbar {
    display: none;
  }

  .shell {
    width: 100%;
    padding: 0;
  }

  .quote-preview {
    border: 0;
    box-shadow: none;
    margin: 0;
  }

  .quote-page {
    width: 210mm;
    min-height: 297mm;
    padding: 0 8mm 5mm;
    border: 0.35mm solid #1e2030;
    font-size: 9.3pt;
  }

  .quote-top-strip {
    height: 7mm;
    margin: 0 -8mm 10mm;
  }

  .modern-header {
    margin-bottom: 11mm;
  }

  .modern-header h2 {
    font-size: 22pt;
  }

  .modern-title {
    margin-bottom: 10mm;
    font-size: 35pt;
  }

  .modern-grid {
    gap: 6mm 14mm;
    margin-bottom: 8mm;
  }

  .client-grid {
    padding: 7mm 0;
  }

  .modern-items {
    margin-bottom: 6mm;
  }

  .modern-items th,
  .modern-items td {
    padding: 1.5mm 1.5mm;
  }

  .modern-bottom {
    grid-template-columns: minmax(0, 1fr) 66mm;
    gap: 8mm;
    margin-bottom: 9mm;
  }

  .modern-totals {
    gap: 4mm;
  }

  .modern-totals p {
    font-size: 24pt;
  }

  .modern-signature {
    width: 105mm;
  }

  .modern-signature div {
    width: 95mm;
  }

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