:root {
  --color-page: #f2f5fa;
  --color-surface: #ffffff;
  --color-text: #17233a;
  --color-text-muted: #68758b;
  --color-border: #dfe5ef;
  --color-border-strong: #c9d3e2;
  --color-primary: #3563df;
  --color-primary-dark: #294eb5;
  --color-primary-soft: #eaf0ff;
  --color-danger: #b93446;
  --color-danger-soft: #fff0f2;
  --color-success: #267344;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --radius-control: 10px;
  --radius-card: 16px;
  --shadow-card: 0 6px 20px rgba(31, 48, 78, 0.07);
  --control-height: 44px;
  font-family: Inter, Arial, sans-serif;
  color: var(--color-text);
  background: var(--color-page);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--color-text);
  background: var(--color-page);
}

body.modal-open {
  overflow: hidden;
}

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

button {
  touch-action: manipulation;
}

[hidden] {
  display: none !important;
}

.container {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  padding: var(--space-6) 0;
  color: white;
  background: #18243b;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
}

.brand h1,
.brand p,
.view-heading h2,
.view-heading p,
.section-heading h3,
.section-heading p,
.estimate-heading h3,
.estimate-heading p,
.modal-heading h2,
.modal-heading p {
  margin-top: 0;
}

.brand h1 {
  margin-bottom: var(--space-1);
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.05;
}

.eyebrow {
  margin-bottom: var(--space-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.72;
}

.subtitle {
  margin-bottom: 0;
  color: #c8d2e5;
  font-size: 14px;
}

.desktop-actions,
.estimate-secondary-actions,
.section-actions,
.settings-actions,
.backup-actions,
.service-row-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.desktop-actions .button {
  min-width: 132px;
}

.app-navigation {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--color-border);
}

.tab-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-width: 760px;
  padding: var(--space-2) 0;
}

.tab-button {
  min-height: var(--control-height);
  padding: 0 var(--space-4);
  color: var(--color-text-muted);
  font-weight: 800;
  background: transparent;
  border: 0;
  border-radius: var(--radius-control);
  cursor: pointer;
}

.tab-button:hover {
  color: var(--color-text);
  background: var(--color-page);
}

.tab-button[aria-selected="true"] {
  color: var(--color-primary-dark);
  background: var(--color-primary-soft);
}

.app-main {
  min-height: 60vh;
  padding: var(--space-7) 0 var(--space-6);
}

.app-view {
  display: block;
}

.view-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}

.view-heading h2 {
  margin-bottom: var(--space-1);
  font-size: 28px;
  line-height: 1.2;
}

.view-heading p,
.section-heading p,
.estimate-heading p,
.modal-heading p {
  margin-bottom: 0;
  color: var(--color-text-muted);
  line-height: 1.45;
}

.estimate-view-heading {
  align-items: center;
}

.card {
  margin-bottom: var(--space-5);
  padding: var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.estimate-heading,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}

.estimate-heading h3,
.section-heading h3 {
  margin-bottom: var(--space-1);
  font-size: 20px;
  line-height: 1.25;
}

.estimate-meta {
  display: flex;
  flex: 0 0 auto;
  gap: var(--space-6);
  margin: 0;
}

.estimate-meta div {
  min-width: 116px;
}

.estimate-meta dt {
  margin-bottom: var(--space-1);
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 800;
}

.estimate-meta dd {
  margin: 0;
  font-weight: 900;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

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

label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: #44516a;
  font-size: 13px;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  min-width: 0;
  min-height: var(--control-height);
  padding: 10px 12px;
  color: var(--color-text);
  background: #fff;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-control);
  outline: none;
}

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

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(53, 99, 223, 0.32);
  outline-offset: 2px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--color-primary);
}

.button {
  min-height: var(--control-height);
  padding: 10px 16px;
  color: white;
  font-weight: 850;
  background: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-control);
  cursor: pointer;
}

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

.button-secondary {
  color: var(--color-primary-dark);
  background: white;
  border-color: #9eb1df;
}

.button-secondary:hover {
  color: var(--color-text);
  background: var(--color-primary-soft);
  border-color: #8299cf;
}

.button-secondary-dark {
  color: #263654;
  background: #edf1f8;
  border-color: #d9e0ec;
}

.button-secondary-dark:hover {
  color: var(--color-text);
  background: #e3e9f3;
  border-color: #cbd5e4;
}

.button-danger-quiet {
  color: var(--color-danger);
  background: transparent;
  border-color: transparent;
}

.button-danger-quiet:hover {
  color: #8d2635;
  background: var(--color-danger-soft);
  border-color: #f0cdd3;
}

.button-danger {
  color: white;
  background: var(--color-danger);
  border-color: var(--color-danger);
}

.button-danger:hover {
  background: #982b3b;
  border-color: #982b3b;
}

.button-small {
  min-height: var(--control-height);
  padding: 8px 12px;
  font-size: 13px;
}

.button-settings {
  background: #425b8f;
  border-color: #425b8f;
}

.button-settings:hover {
  background: #344a78;
  border-color: #344a78;
}

.section-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

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

th,
td {
  padding: 10px 8px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid #e8ecf3;
}

th {
  color: var(--color-text-muted);
  font-size: 11px;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

td input,
td select {
  min-width: 0;
}

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

.items-table th:first-child,
.items-table td:first-child {
  width: 38%;
}

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

.items-table th:nth-child(3),
.items-table td:nth-child(3) {
  width: 12%;
}

.items-table th:nth-child(4),
.items-table td:nth-child(4) {
  width: 17%;
}

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

.items-table th:nth-child(6),
.items-table td:nth-child(6) {
  width: 52px;
}

.item-total {
  white-space: nowrap;
  font-weight: 900;
}

.delete-column {
  text-align: right;
}

.delete-button {
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  color: var(--color-danger);
  font-size: 20px;
  background: var(--color-danger-soft);
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
}

.delete-button:hover {
  background: #ffe1e6;
  border-color: #f2c1c9;
}

.totals-heading {
  margin-bottom: var(--space-4);
}

.totals-layout {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(300px, 420px);
  gap: 48px;
}

.totals-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 170px));
  gap: var(--space-4);
  align-content: start;
}

.totals {
  display: grid;
  gap: var(--space-3);
}

.totals > div {
  display: flex;
  justify-content: space-between;
  gap: var(--space-5);
  color: var(--color-text-muted);
}

.totals strong {
  color: var(--color-text);
}

.grand-total {
  align-items: baseline;
  margin-top: var(--space-1);
  padding-top: var(--space-4);
  color: var(--color-text) !important;
  font-size: 20px;
  border-top: 2px solid var(--color-text);
}

.grand-total strong {
  font-size: 30px;
  letter-spacing: -0.02em;
}

.history-table {
  min-width: 820px;
}

.history-table th:first-child,
.history-table td:first-child {
  width: 115px;
}

.history-table th:nth-child(2),
.history-table td:nth-child(2) {
  width: 110px;
}

.history-table th:nth-child(5),
.history-table td:nth-child(5) {
  width: 130px;
}

.history-table th:last-child,
.history-table td:last-child {
  width: 190px;
}

.history-actions {
  display: flex;
  gap: var(--space-2);
}

.history-total {
  color: var(--color-primary-dark);
  font-size: 15px;
  font-weight: 900;
}

.empty-state {
  display: grid;
  justify-items: start;
  gap: var(--space-1);
  padding: var(--space-6);
  color: var(--color-text-muted);
  background: #f8fafd;
  border: 1px dashed var(--color-border-strong);
  border-radius: 12px;
}

.empty-state strong {
  color: var(--color-text);
}

.service-form {
  display: grid;
  grid-template-columns: minmax(240px, 2fr) minmax(160px, 1fr) minmax(160px, 1fr) auto;
  align-items: end;
  gap: var(--space-4);
}

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

.services-table th:first-child,
.services-table td:first-child {
  width: 36%;
}

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

.services-table th:nth-child(3),
.services-table td:nth-child(3) {
  width: 22%;
}

.services-table th:last-child,
.services-table td:last-child {
  width: 230px;
}

.service-row-actions {
  justify-content: flex-end;
  gap: var(--space-2);
}

.settings-actions {
  margin-top: var(--space-5);
}

.backup-actions {
  flex-wrap: wrap;
}

.hidden-file-input {
  display: none;
}

.inline-status {
  min-height: 1.3em;
  margin: var(--space-3) 0 0;
  color: var(--color-success);
  font-size: 13px;
  font-weight: 800;
}

.print-label,
.print-comment,
.performer-print-contacts,
.print-document-header {
  display: none;
}

.footer {
  padding: var(--space-4) 0 var(--space-7);
  color: var(--color-text-muted);
  font-size: 12px;
}

.toast {
  position: fixed;
  top: var(--space-5);
  right: var(--space-5);
  z-index: 70;
  display: none;
  max-width: min(360px, calc(100% - 32px));
  padding: 12px 16px;
  color: white;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
  background: #243654;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(20, 34, 58, 0.2);
}

.toast.is-visible {
  display: block;
}

.mobile-action-bar {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: var(--space-5);
  background: rgba(15, 25, 43, 0.58);
}

.modal-dialog {
  width: min(820px, 100%);
  max-height: min(720px, calc(100vh - 40px));
  overflow-y: auto;
  padding: var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: 0 24px 64px rgba(13, 25, 47, 0.28);
}

.modal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}

.modal-heading h2 {
  margin-bottom: var(--space-1);
  font-size: 24px;
}

.service-picker-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.service-option {
  display: grid;
  gap: var(--space-2);
  min-height: 88px;
  padding: var(--space-4);
  color: var(--color-text);
  text-align: left;
  background: #fff;
  border: 1px solid var(--color-border-strong);
  border-radius: 12px;
  cursor: pointer;
}

.service-option:hover {
  background: #f8faff;
  border-color: var(--color-primary);
}

.service-option strong {
  font-size: 15px;
}

.service-option span {
  color: var(--color-text-muted);
}

@media (max-width: 900px) {
  .service-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .service-form .button {
    width: 100%;
  }
}

@media (max-width: 820px) {
  .app-main {
    padding-top: var(--space-6);
  }

  .view-heading,
  .estimate-heading,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .estimate-meta {
    width: 100%;
  }

  .estimate-meta div {
    flex: 1;
  }

  .section-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .section-actions .button {
    width: 100%;
  }

  .items-table-wrapper,
  .history-table-wrapper,
  .services-table-wrapper {
    overflow: visible;
  }

  .items-table,
  .history-table,
  .services-table,
  .items-table tbody,
  .history-table tbody,
  .services-table tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .items-table thead,
  .history-table thead,
  .services-table thead {
    display: none;
  }

  .items-table tbody,
  .history-table tbody,
  .services-table tbody {
    display: grid;
    gap: var(--space-3);
  }

  .items-table tr,
  .history-table tr,
  .services-table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-4);
    background: #fbfcff;
    border: 1px solid var(--color-border);
    border-radius: 12px;
  }

  .items-table td,
  .history-table td,
  .services-table td {
    display: block;
    width: auto !important;
    min-width: 0;
    padding: 0;
    border: 0;
  }

  .items-table td::before,
  .history-table td::before,
  .services-table td::before {
    display: block;
    margin-bottom: 6px;
    color: var(--color-text-muted);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    content: attr(data-label);
  }

  .items-table td:first-child,
  .history-table td:nth-child(3),
  .history-table td:nth-child(4),
  .history-table td:last-child,
  .services-table td:first-child,
  .services-table td:last-child {
    grid-column: 1 / -1;
  }

  .items-table td:nth-child(6) {
    display: flex;
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .items-table td:nth-child(6)::before {
    display: none;
  }

  .items-table input,
  .items-table select,
  .services-table input,
  .services-table select {
    min-width: 0;
  }

  .item-total,
  .history-total {
    display: flex;
    align-items: center;
    min-height: var(--control-height);
    font-size: 16px;
  }

  .delete-button {
    width: auto;
    min-width: 112px;
    min-height: var(--control-height);
    padding: 0 14px;
    font-size: 0;
  }

  .delete-button::after {
    font-size: 13px;
    font-weight: 850;
    content: "Удалить";
  }

  .history-actions,
  .service-row-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .history-actions .button,
  .service-row-actions .button {
    width: 100%;
  }

  .history-table td:first-child strong {
    font-size: 17px;
  }

  .history-table td:nth-child(5) {
    font-size: 17px;
  }
}

@media (max-width: 640px) {
  .container {
    width: min(100% - 24px, 1120px);
  }

  body {
    padding-bottom: 78px;
  }

  .site-header {
    padding: 18px 0;
  }

  .header-content {
    align-items: flex-start;
  }

  .brand h1 {
    font-size: 30px;
  }

  .subtitle {
    max-width: 270px;
    font-size: 13px;
  }

  .desktop-actions {
    display: none;
  }

  .tab-list {
    width: 100%;
    padding: 6px 0;
  }

  .tab-button {
    min-width: 0;
    min-height: 40px;
    padding: 6px 5px;
    font-size: 12px;
    line-height: 1.15;
  }

  .app-main {
    padding: var(--space-5) 0;
  }

  .view-heading {
    margin-bottom: var(--space-4);
  }

  .view-heading h2 {
    font-size: 24px;
  }

  .estimate-view-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .estimate-secondary-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .card {
    margin-bottom: var(--space-4);
    padding: var(--space-4);
    border-radius: 14px;
  }

  .estimate-heading,
  .section-heading {
    margin-bottom: var(--space-4);
  }

  .estimate-meta {
    gap: var(--space-3);
  }

  .estimate-meta div {
    min-width: 0;
  }

  .form-grid,
  .totals-layout,
  .totals-inputs,
  .service-form {
    grid-template-columns: 1fr;
  }

  .full-width {
    grid-column: auto;
  }

  .totals-layout {
    gap: var(--space-6);
  }

  .totals-inputs {
    gap: var(--space-3);
  }

  .grand-total {
    font-size: 18px;
  }

  .grand-total strong {
    font-size: 27px;
  }

  .settings-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-actions .button,
  .backup-actions .button {
    width: 100%;
  }

  .backup-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .modal-backdrop {
    align-items: end;
    padding: var(--space-3);
  }

  .modal-dialog {
    max-height: calc(100vh - 24px);
    padding: var(--space-4);
    border-radius: 16px;
  }

  .modal-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .modal-heading .button {
    width: 100%;
  }

  .service-picker-list {
    grid-template-columns: 1fr;
  }

  body[data-active-section="estimate"] .mobile-action-bar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr);
    gap: var(--space-2);
    padding: 10px 12px max(10px, env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -8px 24px rgba(24, 38, 64, 0.1);
  }

  .mobile-action-bar .button {
    width: 100%;
  }

  .toast {
    top: auto;
    right: 12px;
    bottom: 76px;
    left: 12px;
    max-width: none;
  }

  .footer {
    padding-bottom: var(--space-5);
  }
}

@media (max-width: 370px) {
  .container {
    width: min(100% - 20px, 1120px);
  }

  .tab-button {
    font-size: 11px;
  }

  .estimate-secondary-actions {
    grid-template-columns: 1fr;
  }

  .estimate-secondary-actions .button {
    width: 100%;
  }

  .items-table tr,
  .history-table tr,
  .services-table tr {
    gap: 10px;
    padding: 12px;
  }
}

@page {
  size: A4 portrait;
  margin: 10mm;
}

@media print {
  :root {
    color: #152033;
    background: white;
  }

  html,
  body {
    width: auto;
    max-width: none;
    min-width: 0;
    padding: 0;
    overflow: visible;
    color: #152033;
    background: white;
    font-size: 9pt;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .site-header,
  .app-navigation,
  .view-heading,
  .footer,
  .toast,
  .mobile-action-bar,
  .modal-backdrop,
  .desktop-actions,
  .estimate-secondary-actions,
  .backup-card,
  .button,
  .delete-column,
  .delete-button {
    display: none !important;
  }

  .container,
  .app-main {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .app-view {
    display: none !important;
  }

  #estimateView {
    display: block !important;
  }

  .card {
    margin: 0 0 3mm;
    padding: 0 0 3mm;
    background: white;
    border: 0;
    border-bottom: 1px solid #d9dfe8;
    border-radius: 0;
    box-shadow: none;
    break-inside: auto;
  }

  .estimate-card,
  .totals-card {
    break-inside: avoid;
  }

  .print-document-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10mm;
    margin-bottom: 3mm;
    padding-bottom: 3mm;
    border-bottom: 1.5px solid #152033;
  }

  .print-document-title {
    display: block;
    margin-bottom: 1mm;
    font-size: 20pt;
    line-height: 1;
  }

  .print-company-name {
    display: block;
    font-size: 9pt;
    font-weight: 700;
  }

  .print-document-meta {
    display: grid;
    justify-items: end;
    gap: 1mm;
    font-size: 9pt;
  }

  .print-document-meta strong {
    font-size: 12pt;
  }

  .estimate-heading {
    display: none;
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2mm 7mm;
  }

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

  label {
    gap: 0.7mm;
    color: #566278;
    font-size: 7.5pt;
    line-height: 1.2;
  }

  .screen-label {
    display: none;
  }

  .print-label {
    display: inline;
  }

  input,
  textarea,
  select {
    min-height: 0;
    padding: 0;
    color: #152033;
    background: transparent;
    border: 0;
    border-radius: 0;
    outline: 0;
    font-size: 9pt;
    font-weight: 600;
    line-height: 1.2;
    appearance: none;
    -webkit-appearance: none;
  }

  input::placeholder,
  textarea::placeholder {
    color: transparent;
  }

  .comment-field textarea {
    display: none;
  }

  .print-comment {
    display: block;
    min-height: 1.2em;
    color: #152033;
    font-size: 9pt;
    font-weight: 500;
    line-height: 1.25;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  .comment-field.is-print-empty {
    display: none;
  }

  .performer-print-contacts:not(:empty) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1mm 7mm;
    margin-top: 2mm;
    padding-top: 2mm;
    font-size: 7.5pt;
    font-style: normal;
    line-height: 1.2;
    border-top: 1px solid #e1e5ec;
  }

  .performer-print-contact {
    display: flex;
    gap: 1.5mm;
  }

  .performer-print-contact strong {
    color: #566278;
  }

  .performer-print-contact-wide {
    grid-column: 1 / -1;
  }

  .section-heading {
    display: block;
    margin-bottom: 1.5mm;
  }

  .section-heading h3 {
    margin: 0;
    font-size: 11pt;
    line-height: 1.15;
  }

  .section-heading p,
  .section-actions {
    display: none;
  }

  .table-wrapper {
    overflow: visible;
  }

  .items-table,
  .items-table tbody {
    display: table-row-group;
    width: 100%;
    min-width: 0;
  }

  .items-table {
    display: table;
    table-layout: fixed;
    font-size: 8pt;
  }

  .items-table thead {
    display: table-header-group;
  }

  .items-table tr {
    display: table-row;
    width: auto;
    grid-template-columns: none;
    gap: 0;
    padding: 0;
    background: white;
    border: 0;
    border-radius: 0;
    break-inside: avoid;
  }

  .items-table th,
  .items-table td {
    display: table-cell;
    width: auto;
    padding: 1.2mm 1mm;
    border-bottom: 1px solid #e2e6ec;
  }

  .items-table td::before {
    display: none;
  }

  .items-table th {
    color: #5f6b7e;
    font-size: 6.7pt;
  }

  .items-table th:first-child,
  .items-table td:first-child {
    width: 42%;
  }

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

  .items-table th:nth-child(3),
  .items-table td:nth-child(3) {
    width: 12%;
  }

  .items-table th:nth-child(4),
  .items-table td:nth-child(4) {
    width: 16%;
  }

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

  .item-total {
    min-height: 0;
    font-size: 8pt;
  }

  .totals-heading {
    display: none;
  }

  .totals-layout {
    grid-template-columns: 1fr 72mm;
    gap: 8mm;
  }

  .totals-inputs {
    grid-template-columns: repeat(2, minmax(0, 30mm));
    gap: 4mm;
  }

  .totals {
    gap: 1.2mm;
  }

  .totals > div {
    color: #374257;
  }

  .grand-total {
    margin-top: 1mm;
    padding-top: 2mm;
    font-size: 12pt;
    border-top-width: 1px;
  }

  .grand-total strong {
    font-size: 17pt;
  }
}
