:root {
  --ink: #172033;
  --muted: #667085;
  --line: #d9e2ef;
  --blue: #17365d;
  --blue-2: #20557d;
  --paper: #ffffff;
  --bg: #eef3f7;
  --input: #fff4ce;
  --soft: #eaf3f8;
  --danger: #b42318;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font: 14px/1.35 Arial, Segoe UI, sans-serif;
}

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

button, select, input, textarea {
  border: 1px solid #c8d3df;
  border-radius: 6px;
  background: #fff;
}

button {
  min-height: 36px;
  padding: 0 12px;
  cursor: pointer;
}

button.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  font-weight: 700;
}

.release-popup[hidden] {
  display: none;
}

.release-popup {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 36, 63, 0.58);
}

.login-screen[hidden] {
  display: none;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 22px;
  background: linear-gradient(135deg, #10243f, #17365d);
}

.login-card {
  width: min(390px, 100%);
  padding: 26px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0,0,0,.28);
}

.login-card img {
  width: 74px;
  height: 74px;
  object-fit: contain;
}

.login-card h1 {
  margin-top: 12px;
  color: var(--blue);
}

.login-card p {
  margin: 6px 0 16px;
  color: var(--muted);
}

.login-card label {
  margin-top: 10px;
}

.login-card button {
  width: 100%;
  margin-top: 16px;
}

.login-message {
  min-height: 22px;
  margin-top: 10px;
  color: var(--danger);
  font-weight: 700;
}

.release-card {
  position: relative;
  width: min(560px, 100%);
  padding: 26px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 22px 60px rgba(16, 36, 63, 0.22);
}

.release-card h2 {
  margin: 0 0 14px;
  color: var(--blue);
  font-size: 22px;
}

.release-kicker {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.release-card ul {
  margin: 0 0 18px;
  padding-left: 20px;
}

.release-card li {
  margin: 7px 0;
}

.release-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  min-height: 34px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.duration-popup[hidden] {
  display: none;
}

.duration-popup {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16, 36, 63, 0.48);
}

.duration-card {
  position: relative;
  width: min(380px, 100%);
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 22px 60px rgba(16, 36, 63, 0.24);
}

.duration-card h2 {
  margin: 0 0 14px;
  color: var(--blue);
  font-size: 19px;
}

.duration-kicker {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.duration-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  min-height: 32px;
  padding: 0;
  font-size: 21px;
  line-height: 1;
}

.duration-wheels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.duration-wheels label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.duration-wheels select {
  height: 112px;
  padding: 8px;
  background: #fff;
  font-size: 18px;
  font-weight: 700;
}

.duration-preview {
  margin: 14px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--soft);
  color: var(--blue);
  font-size: 18px;
  font-weight: 800;
  text-align: center;
}

.duration-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #10243f;
  color: #fff;
  padding: 18px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.brand img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
}

.brand strong, .brand span {
  display: block;
}

.brand span {
  color: #c8d3df;
  font-size: 12px;
}

.sidebar .primary {
  width: 100%;
  background: #2c6f9f;
  border-color: #2c6f9f;
}

.quote-tools {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.quote-tools input {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
}

.danger-light {
  width: 100%;
  color: #7a271a;
  background: #fff4ed;
  border-color: #f9c7b8;
  font-weight: 700;
}

.quote-list-meta {
  color: #c8d3df;
  font-size: 12px;
}

.quote-list {
  margin-top: 18px;
  display: grid;
  gap: 8px;
}

.hidden {
  display: none !important;
}

.quote-item {
  width: 100%;
  text-align: left;
  color: #fff;
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 6px;
  padding: 10px;
}

.quote-summary {
  text-align: left;
  color: #fff;
}

.quote-summary strong, .quote-summary span {
  display: block;
}

.quote-summary span {
  color: #c8d3df;
  font-size: 12px;
}

.quote-empty {
  padding: 12px;
  color: #c8d3df;
  border: 1px dashed rgba(255,255,255,.24);
  border-radius: 6px;
  font-size: 13px;
}

.quote-actions {
  display: grid;
  grid-template-columns: 1fr 32px 1fr;
  gap: 6px;
  margin-top: 8px;
}

.quote-actions button {
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
  color: #fff;
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.22);
}

.quote-actions .icon-action {
  padding: 0;
  display: grid;
  place-items: center;
}

.quote-actions svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quote-actions button:hover {
  border-color: rgba(255,255,255,.36);
}

.workspace {
  min-width: 0;
  padding: 18px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 14px;
}

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

h1 {
  font-size: 24px;
}

h2 {
  font-size: 15px;
  margin-bottom: 12px;
}

h3 {
  font-size: 13px;
  margin: 18px 0 8px;
}

.pricing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.pricing-header h2 {
  margin-bottom: 0;
}

.pricing-header button {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
  font-weight: 700;
}

.role-panel {
  margin: 12px 0 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}

.admin-panel {
  border-color: #bfd4e8;
}

.user-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.user-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 120px 96px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.user-list-row button {
  min-height: 30px;
}

.user-list-row button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.price-ranges,
.price-sliders {
  display: grid;
  gap: 8px;
}

.price-range-row,
.price-slider-row {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) .7fr .7fr .7fr;
  gap: 8px;
  align-items: end;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.price-slider-row {
  grid-template-columns: minmax(0, 1.2fr) minmax(150px, 1fr) 90px;
  align-items: center;
}

.price-slider-row input[type="range"] {
  height: auto;
  padding: 0;
  background: transparent;
}

body[data-role="user"] #savePricingDefaults,
body[data-role="user"] #adminPanel {
  display: none;
}

.topbar p {
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.user-badge {
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.actions select {
  height: 36px;
  padding: 0 10px;
}

.save-status {
  flex-basis: 100%;
  min-height: 30px;
  padding: 7px 10px;
  border: 1px solid #badbcc;
  border-radius: 6px;
  color: #0f5132;
  background: #d1e7dd;
  font-size: 13px;
  font-weight: 700;
}

.save-status[data-type="error"] {
  color: #842029;
  background: #f8d7da;
  border-color: #f5c2c7;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 560px) minmax(0, 1fr);
  grid-template-areas: "form preview";
  gap: 14px;
  align-items: start;
}

.form-panel { grid-area: form; }

.preview-wrap {
  grid-area: preview;
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.form-panel {
  padding: 14px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}

.tab {
  background: #f8fafc;
  font-weight: 700;
}

.tab.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.tab-page { display: none; }
.tab-page.active { display: block; }

.field-grid {
  display: grid;
  gap: 10px;
}

.field-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

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

label {
  display: grid;
  gap: 4px;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

input, select {
  width: 100%;
  height: 36px;
  padding: 0 9px;
  color: var(--ink);
}

textarea {
  width: 100%;
  min-height: 92px;
  padding: 8px 9px;
  color: var(--ink);
  resize: vertical;
}

input, textarea, .field-grid select {
  background: var(--input);
}

.extras {
  display: grid;
  gap: 6px;
}

.extra-row,
.stop-row,
.disposal-row {
  display: grid;
  grid-template-columns: 1.6fr .8fr .7fr .7fr .8fr 32px;
  gap: 6px;
}

.extra-scope-row {
  grid-template-columns: 1.55fr .9fr .65fr .65fr 34px;
}

.extra-scope-row:not(:has(select)) {
  grid-template-columns: 1.55fr .9fr .65fr .65fr 34px;
}

.blank-extra-row,
.extra-scope-row.blank-extra-row,
.extra-scope-row.blank-extra-row:not(:has(select)) {
  grid-template-columns: 1.4fr .9fr .55fr .65fr .75fr .8fr 34px;
  align-items: end;
}

.blank-extra-row strong {
  min-height: 36px;
  display: grid;
  align-items: center;
  justify-content: end;
  color: var(--brand);
  font-size: 12px;
}

.extra-price-row {
  grid-template-columns: 1.8fr .7fr .8fr;
}

.invoice-order-fields {
  margin-top: 14px;
}

.invoice-item-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr)) 34px;
  gap: 7px 8px;
  align-items: end;
  margin-bottom: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
}

.invoice-item-row label {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
  color: var(--brand);
  font-size: 10px;
  font-weight: 800;
}

.invoice-item-wide {
  grid-column: span 3;
}

.invoice-item-row button {
  grid-column: 7;
  grid-row: 1 / span 2;
  align-self: end;
}

.invoice-item-amount {
  min-height: 36px;
  display: grid;
  align-items: center;
  justify-content: end;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8fbff;
  color: var(--brand);
  font-size: 12px;
  white-space: nowrap;
}

.invoice-payment-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 18px;
  margin-top: 8px;
  font-size: 10.5px;
  color: var(--muted);
}

.stop-row {
  grid-template-columns: 2fr .65fr .7fr .7fr .8fr .9fr .8fr .9fr 32px;
  margin: 10px 0 0;
}

.stops {
  display: grid;
  gap: 10px;
}

.stop-row {
  grid-template-columns: 1fr 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfdff;
}

.stop-row input[data-field="address"] {
  grid-column: 1 / -1;
}

.stop-row button {
  width: 36px;
}

.route-addresses {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.route-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin: -2px 0 12px;
}

.route-tools button {
  min-height: 32px;
}

.route-map-status {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.route-map-status[data-type="ok"] {
  color: #126b45;
}

.route-map-status[data-type="warn"] {
  color: #8a6500;
}

.route-map-status[data-type="error"] {
  color: var(--danger);
}

.pac-container {
  z-index: 99999;
  font-family: Arial, sans-serif;
  border-radius: 8px;
}

.route-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  max-width: 100%;
  overflow: hidden;
}

.route-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.route-card-head strong {
  color: var(--blue);
}

.route-remove {
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 50%;
  line-height: 1;
}

.route-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
}

.route-card-grid label:first-child {
  grid-column: 1 / -1;
}

.route-address-field {
  position: relative;
}

.route-suggestions {
  position: absolute;
  z-index: 50;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  display: grid;
  gap: 2px;
  max-height: 180px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(15, 35, 55, .16);
}

.route-suggestions[hidden] {
  display: none;
}

.route-suggestions button {
  min-height: 30px;
  justify-content: flex-start;
  width: 100%;
  border: 0;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  text-align: left;
}

.route-suggestions button:hover,
.route-suggestions button:focus {
  background: #edf5fb;
}

.route-card-grid input,
.route-card-grid select {
  height: 32px;
}

.route-card-grid label {
  font-size: 11px;
  gap: 3px;
}

.extra-row button,
.stop-row button {
  min-height: 34px;
  padding: 0;
}

.disposal-row {
  grid-template-columns: 1.8fr .8fr;
  margin-top: 6px;
}

.material-row {
  display: grid;
  grid-template-columns: 1.7fr .8fr;
  gap: 6px;
  margin-top: 6px;
  align-items: start;
}

.material-order-fields {
  margin-top: 12px;
}

.lift-order-fields {
  margin-top: 12px;
}

.lift-packages {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 8px 0 12px;
}

.lift-package {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  cursor: pointer;
}

.lift-package.selected {
  border-color: #f5821f;
  box-shadow: 0 0 0 2px rgba(245,130,31,.16);
}

.lift-package input {
  margin-right: 6px;
}

.lift-package strong,
.lift-package span,
.lift-package small {
  display: block;
}

.lift-package span {
  margin-top: 8px;
  font-weight: 700;
}

.lift-pricing {
  display: grid;
  gap: 8px;
}

.lift-price-row {
  display: grid;
  grid-template-columns: .7fr repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
}

.parking-price-grid {
  grid-template-columns: .6fr 1.8fr 1fr 1fr;
}

.material-order-row {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) 120px;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.material-order-row .material-name {
  font-weight: 600;
}

.material-row .material-name {
  font-weight: 600;
}

.material-row small,
.material-order-row small {
  color: var(--muted);
  display: block;
  margin-top: 2px;
}

.disposal-head,
.disposal-total {
  display: grid;
  grid-template-columns: 1.8fr .8fr;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
}

.disposal-head {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  font-weight: 600;
}

.disposal-head.active {
  border-color: #8bb7d8;
}

.disposal-total {
  grid-template-columns: 1fr auto;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.disposal-row.active input {
  border-color: #8bb7d8;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  margin: 8px 0 0;
}

.overnight-warning {
  margin-top: 12px;
}

.warning-box {
  border: 1px solid #f6c56b;
  background: #fff7df;
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.warning-box strong {
  color: #7a3f00;
}

.warning-box span {
  color: #5f4300;
}

.warning-box select {
  background: #fff;
}

#disposalTitle.disposal-visible {
  color: var(--blue);
  padding-top: 8px;
  border-top: 2px solid var(--blue);
}

#materialsTitle.materials-visible {
  color: var(--blue);
  padding-top: 8px;
  border-top: 2px solid var(--blue);
}

input[readonly] {
  background: #eef2f6;
  color: #475467;
}

input.duration-input[readonly] {
  background: var(--input);
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

input.duration-input[readonly]:focus {
  border-color: var(--blue-2);
  box-shadow: 0 0 0 2px rgba(32, 85, 125, .16);
  outline: none;
}

.totals-panel {
  position: static;
  width: 100%;
  max-width: 100%;
}

.form-totals-panel {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

dl {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, max-content);
  gap: 8px 12px;
  margin: 0;
}

dt { color: var(--muted); }
dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
  white-space: normal;
}
.grand { color: var(--blue); font-size: 18px; }
.warn { color: #b42318; font-size: 18px; }

.preview-wrap {
  min-width: 0;
  overflow-x: hidden;
  overflow-y: visible;
}

.document-preview {
  width: min(100%, 210mm);
  min-height: auto;
  box-sizing: border-box;
  background: var(--paper);
  border: 1px solid #d0d5dd;
  box-shadow: 0 8px 28px rgba(16,24,40,.12);
  padding: clamp(18px, 2.1vw, 14mm) clamp(16px, 2vw, 13mm);
  margin: 0 auto;
  font-size: 12px;
  font-family: Aptos, Calibri, "Segoe UI", Arial, sans-serif;
  font-weight: 400;
  font-synthesis: none;
  -webkit-font-smoothing: auto;
  text-rendering: auto;
  overflow: hidden;
}

.document-preview * {
  font-synthesis: none;
}

.document-preview strong,
.document-preview b,
.document-preview th,
.document-preview .doc-title,
.document-preview .doc-section h3,
.document-preview .quote-document-title,
.document-preview .quote-section-label,
.document-preview .quote-doc-label,
.document-preview .quote-doc-number,
.document-preview .total-row strong {
  font-weight: 700;
}

.din-letter-head,
.doc-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

.sender-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44mm;
  gap: 12px;
  align-items: center;
  line-height: 1.32;
}

.doc-header-logo {
  width: min(100%, 115mm);
  max-height: 24mm;
  object-fit: contain;
  object-position: left center;
}

.doc-header-contact {
  font-size: 10px;
  line-height: 1.25;
  text-align: right;
}

.doc-logo {
  max-width: 115px;
  max-height: 115px;
  object-fit: contain;
  justify-self: end;
}

.din-address-row {
  display: grid;
  grid-template-columns: 85mm 1fr;
  gap: 14mm;
  align-items: start;
  margin-top: 20mm;
}

.din-address-field {
  width: 85mm;
  min-height: 45mm;
  padding-top: 0;
  box-sizing: border-box;
}

.sender-line {
  min-height: 5mm;
  border-bottom: 1px solid #d0d5dd;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.2;
  padding: 0 0 0 5mm;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recipient-address {
  padding: 5mm 6mm 0 5mm;
  font-size: 12px;
  line-height: 1.35;
  box-sizing: border-box;
  min-height: 34mm;
}

.doc-facts {
  display: grid;
  gap: 4px;
  font-size: 11px;
}

.doc-facts div {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 3px;
}

.doc-facts strong {
  font-weight: 700;
}

.invoice-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 68mm;
  grid-template-areas:
    "company logo"
    "recipient meta";
  gap: 18mm 18mm;
  align-items: start;
  width: 170mm;
  margin: 0 20mm 8mm;
}

.invoice-company-address {
  grid-area: company;
  font-size: 9.5pt;
  line-height: 1.28;
}

.invoice-head-logo {
  grid-area: logo;
  justify-self: end;
  width: 28mm;
  max-height: 22mm;
  object-fit: contain;
}

.invoice-recipient {
  grid-area: recipient;
  font-size: 9.5pt;
  line-height: 1.28;
  min-height: 24mm;
}

.invoice-meta {
  grid-area: meta;
  display: grid;
  gap: 2px;
  font-size: 9.5pt;
  line-height: 1.25;
}

.invoice-meta div {
  display: grid;
  grid-template-columns: 30mm minmax(0, 1fr);
  gap: 5mm;
}

.invoice-meta span {
  text-align: right;
}

.invoice-title {
  margin-top: 2mm;
}

.quote-head {
  width: 170mm;
  margin: 0 20mm 7mm;
  color: var(--ink);
}

.quote-topline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 43mm 43mm;
  gap: 5mm;
  align-items: center;
  margin-bottom: 4mm;
  background: var(--blue);
  color: #fff;
  padding: 4px 7px;
}

.quote-document-title {
  font-size: 14.5pt;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: 0;
}

.quote-doc-label,
.quote-doc-number {
  font-size: 8.8pt;
  font-weight: 700;
}

.quote-doc-number {
  text-align: right;
}

.quote-company-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38mm;
  gap: 8mm;
  align-items: center;
  min-height: 22mm;
  padding: 0 7px 1mm;
  box-sizing: border-box;
}

.quote-company-data {
  display: grid;
  grid-template-columns: 28mm minmax(0, 1fr);
  gap: 1px 4mm;
  font-size: 9.1pt;
  line-height: 1.18;
}

.quote-company-data strong {
  grid-column: 1 / -1;
  font-weight: 700;
}

.quote-company-data > span:nth-child(2),
.quote-company-data > span:nth-child(3) {
  grid-column: 1 / -1;
}

.quote-head-logo {
  justify-self: end;
  width: 30mm;
  max-height: 23mm;
  object-fit: contain;
}

.quote-customer-block {
  margin-top: 4mm;
}

.quote-section-label {
  background: var(--blue-2);
  color: #fff;
  padding: 3px 6px;
  margin-bottom: 3px;
  font-size: 9.5pt;
  font-weight: 700;
  line-height: 1.15;
}

.quote-customer-grid {
  display: grid;
  grid-template-columns: 27mm 55mm 34mm minmax(0, 1fr);
  padding: 1px 6px 0;
  font-size: 9.1pt;
  line-height: 1.26;
}

.quote-customer-grid strong {
  font-weight: 700;
}

.quote-customer-grid span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.quote-note-block {
  display: grid;
  grid-template-columns: 42mm minmax(0, 1fr);
  gap: 4px 8px;
  margin-top: 4px;
  padding: 5px 6px;
  border: 1px solid #d5e1ec;
  background: #f8fbfd;
  font-size: 9.1pt;
  line-height: 1.28;
}

.quote-note-block strong {
  color: var(--blue);
}

.quote-note-block span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.quote-intro {
  margin: 5mm 0 0;
  font-size: 9.2pt;
  line-height: 1.3;
}

.doc-title {
  margin-top: 16px;
  background: var(--blue);
  color: #fff;
  padding: 7px 9px;
  font-size: 21px;
  font-weight: 700;
}

.doc-title.small {
  margin-top: 0;
  font-size: 18px;
}

.doc-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0;
}

.doc-section {
  margin-top: 12px;
}

.render-error {
  border: 1px solid #f0b8b3;
  background: #fff3f2;
  color: var(--danger);
  padding: 12px;
}

.doc-section h3 {
  background: var(--blue-2);
  color: #fff;
  padding: 5px 7px;
  margin: 0 0 6px;
  font-weight: 700;
}

.doc-grid {
  display: grid;
  grid-template-columns: 120px 1fr 130px 1fr;
  gap: 5px 10px;
}

.doc-grid strong {
  font-weight: 700;
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.doc-table th, .doc-table td {
  border-bottom: 1px solid var(--line);
  padding: 5px 6px;
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: normal;
  line-height: 1.28;
}

.doc-table th {
  background: var(--soft);
  text-align: left;
  font-weight: 700;
}

.disposal-table {
  table-layout: fixed;
}

.disposal-table .w-waste { width: 46%; }
.disposal-table .w-price { width: 20%; }
.disposal-table .w-volume { width: 17%; }
.disposal-table .w-amount { width: 17%; }

.subtotal-row td {
  border-top: 1px solid #111827;
  border-bottom: 0;
}

.num {
  text-align: right;
  white-space: nowrap;
}

.service-table th:nth-child(1),
.service-table td:nth-child(1) { width: 29%; }

.service-table th:nth-child(2),
.service-table td:nth-child(2) { width: 18%; }

.service-table th:nth-child(3),
.service-table td:nth-child(3) { width: 13%; text-align: right; }

.service-table th:nth-child(4),
.service-table td:nth-child(4) { width: 12%; text-align: left; }

.service-table th:nth-child(5),
.service-table td:nth-child(5),
.service-table th:nth-child(6),
.service-table td:nth-child(6) { width: 14%; text-align: right; }

.service-table td {
  min-height: 26px;
}

.invoice-doc-table th:nth-child(1),
.invoice-doc-table td:nth-child(1) { width: 7%; }

.invoice-doc-table th:nth-child(2),
.invoice-doc-table td:nth-child(2) { width: 40%; }

.invoice-doc-table th:nth-child(3),
.invoice-doc-table td:nth-child(3) { width: 10%; }

.invoice-doc-table th:nth-child(4),
.invoice-doc-table td:nth-child(4) { width: 11%; }

.invoice-doc-table th:nth-child(5),
.invoice-doc-table td:nth-child(5) { width: 16%; }

.invoice-doc-table th:nth-child(6),
.invoice-doc-table td:nth-child(6) { width: 16%; }

.invoice-doc-table {
  font-size: 10px;
}

.invoice-doc-table th,
.invoice-doc-table td {
  padding-left: 5px;
  padding-right: 5px;
}

.invoice-doc-table th {
  line-height: 1.15;
  white-space: normal;
}

.invoice-doc-table td span {
  display: inline-block;
  margin-top: 2px;
}

.extras-doc-table th:nth-child(1),
.extras-doc-table td:nth-child(1) { width: 32%; }

.extras-doc-table th:nth-child(2),
.extras-doc-table td:nth-child(2) { width: 30%; }

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

.extras-doc-table th:nth-child(4),
.extras-doc-table td:nth-child(4) { width: 20%; text-align: right; }

.blank-doc-table th:nth-child(1),
.blank-doc-table td:nth-child(1) { width: 26%; text-align: left; }

.blank-doc-table th:nth-child(2),
.blank-doc-table td:nth-child(2) { width: 18%; text-align: left; }

.blank-doc-table th:nth-child(3),
.blank-doc-table td:nth-child(3) { width: 12%; text-align: right; }

.blank-doc-table th:nth-child(4),
.blank-doc-table td:nth-child(4) { width: 12%; text-align: left; }

.blank-doc-table th:nth-child(5),
.blank-doc-table td:nth-child(5),
.blank-doc-table th:nth-child(6),
.blank-doc-table td:nth-child(6) { width: 16%; text-align: right; }

.time-doc-table th:nth-child(1),
.time-doc-table td:nth-child(1) { width: 22%; }

.time-doc-table th:nth-child(2),
.time-doc-table td:nth-child(2) {
  width: 24%;
  text-align: right;
}

.time-doc-table th:nth-child(3),
.time-doc-table td:nth-child(3) {
  width: 26%;
  text-align: right;
}

.time-doc-table th:nth-child(4),
.time-doc-table td:nth-child(4) {
  width: 28%;
  text-align: left;
}

.time-doc-table th {
  white-space: normal;
  line-height: 1.2;
}

.summary {
  margin-left: auto;
  width: 300px;
}

.doc-closing {
  margin-top: 12px;
  break-inside: avoid;
  page-break-inside: avoid;
}

.summary .total-row {
  display: grid;
  grid-template-columns: 1fr auto;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
}

.summary .grand {
  font-size: 16px;
  color: var(--ink);
  font-weight: 700;
}

.invoice-page {
  color: #111827;
}

.invoice-page .doc-title {
  background: transparent;
  color: #111827;
  padding: 0;
  font-size: 16pt;
  font-weight: 700;
}

.invoice-page .doc-section h3 {
  background: transparent;
  color: #111827;
  padding: 0 0 2px;
  border-bottom: 1px solid #111827;
  font-weight: 700;
}

.invoice-page .doc-table th {
  background: #fff;
  color: #111827;
  border-bottom-color: #111827;
}

.invoice-page .doc-table td {
  border-bottom-color: #d6dde6;
}

.invoice-page .invoice-doc-table th,
.invoice-page .invoice-doc-table td {
  border: 1px solid #111827;
}

.invoice-page .invoice-doc-table th {
  text-align: center;
}

.invoice-page .invoice-doc-table th:nth-child(3),
.invoice-page .invoice-doc-table td:nth-child(3),
.invoice-page .invoice-doc-table th:nth-child(5),
.invoice-page .invoice-doc-table td:nth-child(5),
.invoice-page .invoice-doc-table th:nth-child(6),
.invoice-page .invoice-doc-table td:nth-child(6) {
  text-align: right;
}

.invoice-page .invoice-doc-table td:first-child {
  vertical-align: middle;
}

.invoice-page .doc-section.summary {
  width: 170mm;
  max-width: 170mm;
  margin: 6px 20mm 0;
  box-sizing: border-box;
}

.invoice-page .summary .total-row {
  grid-template-columns: 1fr 40mm;
  padding: 2px 0;
  border-bottom-color: #111827;
}

.invoice-page .summary .total-row span {
  justify-self: end;
  text-align: right;
  white-space: nowrap;
}

.invoice-page .grand,
.invoice-page .summary .grand {
  color: #111827;
}

.invoice-terms {
  margin-top: 14px;
  font-size: 9pt;
  line-height: 1.35;
}

.doc-footer {
  margin-top: 18px;
}

.company-footer {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 10px;
  line-height: 1.35;
}

.company-footer div:nth-child(2) {
  text-align: center;
}

.company-footer div:nth-child(3) {
  text-align: right;
}

.agreement-page {
  margin-top: 18mm;
  min-height: 260mm;
}

.page-break {
  break-before: page;
  page-break-before: always;
}

.legal-attachment-page {
  margin-top: 0;
  min-height: 297mm;
  padding: 10mm 0;
  overflow: hidden;
  background: #fff;
}

.legal-attachment-content {
  flex: 1 1 auto;
  width: 170mm;
  margin: 4mm 20mm 0;
  overflow: hidden;
}

.legal-attachment-page .doc-title {
  margin: 0 0 4px;
  width: auto;
}

.legal-subtitle {
  margin-bottom: 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 8.5pt;
}

.legal-text-body {
  font-size: 8.6pt;
  line-height: 1.32;
  color: #111827;
}

.legal-text-body p {
  margin: 0 0 5px;
}

.legal-text-body p span,
.legal-text-body p strong {
  display: block;
}

.legal-text-body p span {
  margin-top: 2px;
}

.legal-section-paragraph {
  margin-top: 7px;
}

.legal-section-paragraph > strong,
.legal-section-paragraph::first-line {
  font-weight: 700;
}

.legal-smallprint .legal-text-body {
  font-size: 7.05pt;
  line-height: 1.24;
}

.legal-two-columns {
  column-count: 1;
}

.contract-grid,
.signature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin: 14px 0;
}

.signature-grid {
  margin-top: 24mm;
}

.signature-grid-single {
  grid-template-columns: 1fr;
  max-width: 85mm;
  margin-left: auto;
}

.signature-grid div {
  border-top: 1px solid #111827;
  padding-top: 6px;
  min-height: 34px;
}

.signature-grid span,
.signature-grid b {
  display: block;
}

.signature-grid b {
  font-weight: 700;
}

.doc-table.compact td,
.doc-table.compact th {
  padding: 6px 7px;
}

.route-doc-table {
  font-size: 10.2px;
}

.route-doc-table th,
.route-doc-table td {
  padding: 4px 5px;
  word-break: break-word;
}

.route-doc-table th:nth-child(1),
.route-doc-table td:nth-child(1) {
  width: 9%;
}

.route-doc-table th:nth-child(2),
.route-doc-table td:nth-child(2) {
  width: 24%;
}

.route-doc-table th:nth-child(4),
.route-doc-table td:nth-child(4) {
  width: 8%;
}

.doc-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 10.5px;
}

.notes-box {
  height: 45mm;
  border: 1px solid var(--line);
  margin: 8px 0 12px;
}

.check-line {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 7px 0;
}

.check-line span,
.check-box {
  width: 14px;
  height: 14px;
  border: 1px solid #111827;
  display: inline-block;
  flex: 0 0 auto;
}

.payment-options-table th:first-child,
.payment-options-table td:first-child {
  width: 42px;
  text-align: center;
  vertical-align: middle;
}

.payment-options-table th:nth-child(2),
.payment-options-table td:nth-child(2) {
  width: 24%;
}

.payment-options-table th:nth-child(4),
.payment-options-table td:nth-child(4) {
  width: 25%;
}

.payment-option-box {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1px solid #111827;
  background: #fff;
  box-sizing: border-box;
  vertical-align: middle;
}

.combined-agreement-page .contract-grid {
  margin-bottom: 8px;
}

.combined-agreement-page .doc-section {
  margin-top: 8px;
}

.combined-agreement-page p {
  margin: 3px 0;
  line-height: 1.24;
}

.combined-agreement-page .doc-table.compact th,
.combined-agreement-page .doc-table.compact td {
  padding-top: 3px;
  padding-bottom: 3px;
  line-height: 1.18;
}

.combined-agreement-page .check-line {
  margin: 4px 0;
}

.combined-agreement-page .signature-grid {
  margin-top: 8mm;
}

.amount-line {
  border-bottom: 1px solid #111827 !important;
}

@media (max-width: 1260px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content-grid {
    grid-template-columns: minmax(0, 520px) minmax(0, 1fr);
    grid-template-areas: "form preview";
  }
  .totals-panel { position: static; }
  .document-preview { min-height: auto; }
}

@media (max-width: 860px) {
  .workspace { padding: 10px; }
  .topbar { align-items: stretch; flex-direction: column; }
  .actions { flex-wrap: wrap; }
  .content-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "form"
      "preview";
  }
  .invoice-item-row,
  .field-grid.two,
  .field-grid.three { grid-template-columns: 1fr; }
  .invoice-item-wide { grid-column: auto; }
  .invoice-item-row button {
    grid-column: auto;
    grid-row: auto;
  }
  .route-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .route-card-grid label:first-child { grid-column: 1 / -1; }
}

@media screen {
  .preview-wrap {
    overflow-x: auto;
    padding-bottom: 18px;
  }
  .document-preview {
    width: 210mm;
    max-width: none;
    min-height: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
    overflow: visible;
    font-size: 9pt;
    line-height: 1.25;
    zoom: .58;
  }
  .document-preview > * {
    max-width: 210mm;
    box-sizing: border-box;
  }
  .print-page,
  .agreement-page {
    display: flex;
    flex-direction: column;
    width: 210mm;
    min-width: 210mm;
    max-width: 210mm;
    height: 297mm;
    min-height: 297mm;
    max-height: 297mm;
    box-sizing: border-box;
    margin: 0 auto 14px;
    padding: 10mm 0;
    background: #fff;
    border: 1px solid #d0d5dd;
    box-shadow: 0 8px 24px rgba(16,24,40,.12);
  }
  .print-page.main-print-page {
    height: auto;
    min-height: 297mm;
    max-height: none;
    overflow: visible;
  }
  .legal-attachment-page {
    padding: 10mm 0;
    overflow: hidden;
  }
  .legal-attachment-content {
    width: 170mm;
    margin: 4mm 20mm 0;
  }
  .legal-attachment-page .doc-title {
    margin: 0 0 4px;
    width: auto;
  }
  .din-letter-head,
  .doc-head {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .din-letter-head {
    position: static;
    height: 12mm;
    margin: 0 20mm 5mm;
    width: 170mm;
    background: #fff;
  }
  .sender-block {
    grid-template-columns: 1fr 45mm;
    gap: 7mm;
    align-items: center;
    height: 12mm;
  }
  .doc-header-logo {
    width: 58mm;
    max-height: 10mm;
    object-fit: contain;
    object-position: left center;
  }
  .doc-header-contact {
    font-size: 6.3pt;
    line-height: 1.05;
    text-align: right;
  }
  .din-address-row {
    grid-template-columns: 85mm 75mm;
    gap: 10mm;
    margin: 8mm 20mm 0;
    min-height: 45mm;
    width: 170mm;
  }
  .din-address-field {
    width: 85mm;
    height: 45mm;
    padding-top: 0;
    overflow: hidden;
    box-sizing: border-box;
  }
  .sender-line {
    font-size: 6.7pt;
    min-height: 5mm;
    padding-top: 0;
    padding-left: 5mm;
  }
  .recipient-address {
    font-size: 9.6pt;
    padding: 5mm 6mm 0 5mm;
    line-height: 1.32;
    min-height: 34mm;
  }
  .doc-facts {
    font-size: 8.5pt;
    min-width: 0;
  }
  .doc-title {
    margin: 5mm 20mm 0;
    width: 170mm;
    padding: 4px 7px;
    font-size: 14.5pt;
    font-weight: 700;
  }
  .doc-title.small {
    font-size: 13.5pt;
  }
  .doc-section {
    margin: 6px 20mm 0;
    width: 170mm;
  }
  .doc-section h3 {
    padding: 3px 6px;
    margin-bottom: 4px;
    font-weight: 700;
    font-size: 9.5pt;
  }
  .doc-table th,
  .doc-table td {
    padding: 2.8px 4px;
    line-height: 1.2;
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: normal;
  }
  .invoice-doc-table,
  .route-doc-table,
  .time-doc-table,
  .extras-doc-table,
  .disposal-table,
  .service-table {
    font-size: 8.6pt;
  }
  .doc-note,
  .invoice-payment-info {
    font-size: 8.3pt;
    line-height: 1.22;
  }
  .grand {
    font-size: 12.5pt;
  }
  .summary {
    width: 245px;
    margin-top: 0;
    margin-left: auto;
    margin-right: 20mm;
  }
  .summary .total-row {
    padding: 1.8px 0;
  }
  .doc-footer {
    margin: 10px 20mm 0;
    width: 170mm;
  }
  .company-footer {
    width: 170mm;
    margin: auto 20mm 0;
    padding-top: 2mm;
    font-size: 6.9pt;
    line-height: 1.15;
    background: #fff;
  }
  .doc-closing {
    width: 210mm;
    margin-top: 6px;
  }
  .contract-grid,
  .signature-grid {
    gap: 12px;
    margin: 8px 20mm;
    width: 170mm;
  }
  .signature-grid {
    margin: 10mm 20mm 0;
  }
  .combined-agreement-page .contract-grid {
    margin-top: 5px;
    margin-bottom: 5px;
  }
  .combined-agreement-page .doc-section {
    margin-top: 4px;
  }
  .combined-agreement-page p {
    margin: 2px 0;
    line-height: 1.18;
  }
  .combined-agreement-page .doc-table.compact th,
  .combined-agreement-page .doc-table.compact td {
    padding-top: 2px;
    padding-bottom: 2px;
    line-height: 1.12;
  }
  .combined-agreement-page .check-line {
    margin: 2px 0;
  }
  .combined-agreement-page .signature-grid {
    margin-top: 5mm;
  }
  .notes-box {
    height: 30mm;
  }
}

@media screen and (min-width: 1500px) {
  .document-preview { zoom: .72; }
}

@media screen and (min-width: 1700px) {
  .document-preview { zoom: .9; }
}

@media screen and (min-width: 1850px) {
  .document-preview { zoom: 1; }
}

@media print {
  html,
  body {
    width: 210mm !important;
    min-height: 0;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff;
  }
  body, .document-preview {
    font-family: Aptos, Calibri, "Segoe UI", Arial, sans-serif !important;
    font-weight: 400;
    font-synthesis: none;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .document-preview * {
    font-synthesis: none;
  }
  strong, b, th, .total-row strong {
    font-weight: 700;
  }
  .sidebar, .topbar, .form-panel, .totals-panel { display: none !important; }
  .app-shell, .workspace, .content-grid, .preview-wrap {
    display: block;
    padding: 0;
    margin: 0;
  }
  .document-preview {
    box-shadow: none;
    border: 0;
    width: 210mm !important;
    max-width: 210mm !important;
    min-height: 0;
    padding: 0;
    margin: 0;
    font-size: 9pt;
    line-height: 1.25;
    overflow: visible;
    box-sizing: border-box;
    padding-bottom: 0;
  }
  .document-preview > * {
    max-width: 210mm !important;
    box-sizing: border-box;
  }
  .print-page,
  .agreement-page {
    display: flex;
    flex-direction: column;
    width: 210mm !important;
    min-width: 210mm !important;
    max-width: 210mm !important;
    height: 297mm;
    min-height: 297mm;
    max-height: 297mm;
    box-sizing: border-box;
    padding: 10mm 0;
  }
  .print-page.main-print-page {
    height: auto;
    min-height: 297mm;
    max-height: none;
    overflow: visible;
    break-inside: auto;
    page-break-inside: auto;
  }
  .legal-attachment-page {
    padding: 10mm 0 !important;
    overflow: hidden;
    break-before: page;
    page-break-before: always;
  }
  .legal-attachment-content {
    width: 170mm;
    margin: 4mm 20mm 0;
  }
  .legal-attachment-page .doc-title {
    margin: 0 0 4px;
    width: auto;
  }
  .legal-text-body {
    font-size: 8.1pt;
    line-height: 1.26;
  }
  .legal-smallprint .legal-text-body {
    font-size: 6.8pt;
    line-height: 1.2;
  }
  .main-print-page {
    break-inside: auto;
    page-break-inside: auto;
  }
  .din-letter-head,
  .doc-head {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .din-letter-head {
    position: static;
    height: 12mm;
    margin: 0 20mm 5mm;
    width: 170mm;
    background: #fff;
  }
  .sender-block {
    grid-template-columns: 1fr 45mm;
    gap: 7mm;
    align-items: center;
    height: 12mm;
  }
  .doc-header-logo {
    width: 58mm;
    max-height: 10mm;
    object-fit: contain;
    object-position: left center;
  }
  .doc-header-contact {
    font-size: 6.3pt;
    line-height: 1.05;
    text-align: right;
  }
  .din-address-row {
    grid-template-columns: 85mm 75mm;
    gap: 10mm;
    margin: 8mm 20mm 0;
    min-height: 45mm;
    width: 170mm;
  }
  .din-address-field {
    width: 85mm;
    height: 45mm;
    padding-top: 0;
    overflow: hidden;
    box-sizing: border-box;
  }
  .sender-line {
    font-size: 6.7pt;
    min-height: 5mm;
    padding-top: 0;
    padding-left: 5mm;
  }
  .recipient-address {
    font-size: 9.6pt;
    padding: 5mm 6mm 0 5mm;
    line-height: 1.32;
    min-height: 34mm;
  }
  .doc-facts {
    font-size: 8.5pt;
    min-width: 0;
  }
  .doc-logo {
    max-width: 95px;
    max-height: 95px;
  }
  .doc-title {
    margin: 5mm 20mm 0;
    width: 170mm;
    padding: 4px 7px;
    font-size: 14.5pt;
    font-weight: 700;
  }
  .doc-title.small {
    font-size: 13.5pt;
  }
  .doc-meta {
    gap: 8px;
    margin: 8px 0;
  }
  .doc-section {
    margin: 6px 20mm 0;
    width: 170mm;
    break-inside: auto;
    page-break-inside: auto;
  }
  .doc-section h3 {
    padding: 3px 6px;
    margin-bottom: 4px;
    font-weight: 700;
    font-size: 9.5pt;
  }
  .doc-table {
    table-layout: fixed;
    page-break-inside: auto;
  }
  .doc-table th,
  .doc-table td {
    padding: 2.8px 4px;
    line-height: 1.2;
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: normal;
  }
  .invoice-doc-table,
  .route-doc-table,
  .time-doc-table,
  .extras-doc-table,
  .disposal-table,
  .service-table {
    font-size: 8.6pt;
  }
  .doc-note,
  .invoice-payment-info {
    font-size: 8.3pt;
    line-height: 1.22;
  }
  .grand {
    font-size: 12.5pt;
  }
  .doc-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .summary {
    width: 245px;
    margin-top: 0;
    margin-left: auto;
    margin-right: 20mm;
  }
  .summary .total-row {
    padding: 1.8px 0;
  }
  .doc-footer {
    margin: 10px 20mm 0;
    width: 170mm;
  }
  .company-footer {
    width: 170mm;
    margin: auto 20mm 0;
    padding-top: 2mm;
    font-size: 6.9pt;
    line-height: 1.15;
    position: static;
    background: #fff;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .doc-closing {
    width: 210mm;
    margin-top: 6px;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .agreement-page {
    margin-top: 0;
    padding-top: 10mm;
    break-before: page;
    page-break-before: always;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .page-break {
    break-before: page;
    page-break-before: always;
  }
  .agreement-page .doc-title {
    margin-top: 0;
  }
  .agreement-page + .agreement-page {
    margin-top: 0;
  }
  .contract-grid,
  .signature-grid {
    gap: 12px;
    margin: 8px 20mm;
    width: 170mm;
  }
  .signature-grid {
    margin: 10mm 20mm 0;
  }
  .notes-box {
    height: 30mm;
  }
  .time-doc-table th:nth-child(1),
  .time-doc-table td:nth-child(1) { width: 20%; }
  .time-doc-table th:nth-child(2),
  .time-doc-table td:nth-child(2) { width: 22%; }
  .time-doc-table th:nth-child(3),
  .time-doc-table td:nth-child(3) { width: 24%; }
  .time-doc-table th:nth-child(4),
  .time-doc-table td:nth-child(4) { width: 34%; }
  .doc-title {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  .doc-section h3 {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  @page {
    size: A4 portrait;
    margin: 0 !important;
  }
}
