:root {
  --ink: #16201b;
  --muted: #60706a;
  --line: #d8dfdb;
  --paper: #ffffff;
  --soft: #f4f7f5;
  --field: #fbfcfb;
  --accent: #176b5f;
  --accent-dark: #0f4b43;
  --gold: #b88422;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: #eef3f0;
  font-family: "Times New Roman", Times, serif;
  font-size: 12px;
}

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

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
  padding: 0 14px;
}

button:hover {
  border-color: var(--accent);
}

button.primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  color: var(--ink);
  padding: 9px 10px;
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.client-grid label {
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}

.client-grid .wide {
  grid-column: span 2;
}

label input,
label select {
  color: var(--ink);
  font-size: 14px;
  font-weight: 400;
  text-transform: none;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 5;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 26px;
}

h2 {
  font-size: 17px;
}

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

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #eef3f0;
}

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

.login-box {
  width: min(360px, 100%);
  display: grid;
  gap: 12px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 12px 32px rgba(22, 32, 27, 0.16);
}

.login-box img {
  width: 110px;
  height: 78px;
  object-fit: contain;
  justify-self: center;
}

.login-box h1 {
  text-align: center;
  color: var(--accent-dark);
}

#loginStatus {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-weight: 700;
  text-align: center;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  padding: 18px;
  max-width: 1500px;
  margin: 0 auto;
}

.invoice-panel,
.catalog-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.invoice-panel {
  padding: 28px;
}

.catalog-panel {
  padding: 16px;
  align-self: start;
  position: sticky;
  top: 82px;
  max-height: calc(100vh - 100px);
  overflow: auto;
  font-size: 12px;
}

.invoice-top {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 310px;
  gap: 28px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--accent-dark);
}

.company-name {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 32px;
  font-weight: 800;
}

.brand-line {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
}

.company-logo {
  width: 150px;
  height: 94px;
  object-fit: contain;
}

.company-tagline {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.brand-block textarea {
  margin-top: 10px;
}

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

.client-grid {
  margin: 22px 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.document-title {
  display: grid;
  justify-items: center;
  gap: 4px;
  margin: 18px 0 14px;
  text-align: center;
}

.document-title h2 {
  font-size: 28px;
  color: var(--ink);
  text-transform: uppercase;
}

.document-title p {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.wide {
  grid-column: span 2;
}

.line-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px 110px;
  gap: 8px;
  margin-bottom: 12px;
}

.stamp-toggle {
  display: flex;
  width: max-content;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px auto;
  color: var(--ink);
  text-transform: none;
}

.stamp-toggle input {
  width: auto;
}

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

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

.print-invoice-table {
  display: none;
}

.invoice-table th,
.invoice-table td {
  border: 1px solid var(--line);
  padding: 4px 5px;
  vertical-align: top;
}

.invoice-table th {
  color: #fff;
  font-size: 12px;
  text-align: left;
  text-transform: uppercase;
  background: var(--accent-dark);
}

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

.invoice-table th:nth-child(1) {
  width: 90px;
}

.invoice-table th:nth-child(2) {
  width: 38%;
}

.invoice-table th:nth-child(3),
.invoice-table th:nth-child(5),
.invoice-table th:nth-child(6) {
  width: 74px;
}

.invoice-table th:nth-child(4),
.invoice-table th:nth-child(7) {
  width: 120px;
}

.invoice-table th:nth-child(8) {
  width: 48px;
}

.invoice-table input,
.invoice-table textarea,
.invoice-table select {
  min-width: 0;
  padding: 2px 3px;
  border-radius: 5px;
  font-size: 12px;
  line-height: 1.15;
}

.invoice-table td:nth-child(2),
.invoice-table td:nth-child(2) textarea {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

.invoice-table td:nth-child(2) textarea {
  min-height: 28px;
  line-height: 1.15;
}

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

.print-value {
  display: none;
}

.invoice-bottom {
  margin-top: 12px;
}

.tax-total-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 24px;
  align-items: start;
  margin-top: 18px;
}

.document-footer-block {
  margin-top: 12px;
}

.tax-table,
.totals {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper);
  border-collapse: collapse;
}

.tax-table th,
.tax-table td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: right;
}

.tax-table th {
  color: #fff;
  background: var(--accent-dark);
  text-align: center;
}

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

.totals div:last-child {
  border-bottom: 0;
  color: #fff;
  background: var(--accent-dark);
  font-size: 18px;
}

.detailed-totals div {
  padding: 5px 7px;
  font-size: 12px;
}

.amount-words {
  margin: 12px 0 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.signature-block {
  display: grid;
  justify-content: end;
  justify-items: center;
  gap: 4px;
  margin-top: 16px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
}

.signature-block img {
  width: 220px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.catalog-head,
.saved-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.catalog-head select {
  max-width: 170px;
}

.search {
  margin: 8px 0;
  padding: 6px 8px;
  font-size: 12px;
}

.product-list,
.saved-list {
  display: grid;
  gap: 5px;
}

.product-row,
.saved-row {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 6px 7px;
}

.product-row {
  cursor: pointer;
}

.product-row:hover {
  border-color: var(--accent);
  background: var(--soft);
}

.product-main,
.saved-main {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.product-title,
.saved-title {
  font-weight: 800;
  line-height: 1.12;
  font-size: 12px;
}

.product-meta,
.saved-meta {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.1;
}

.price-pill {
  color: var(--accent-dark);
  font-weight: 800;
  white-space: nowrap;
  font-size: 12px;
}

.saved-box {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.dashboard {
  position: fixed;
  inset: 0;
  z-index: 20;
  padding: 18px;
  background: rgba(22, 32, 27, 0.45);
  overflow: auto;
}

.dashboard-panel {
  max-width: 1180px;
  margin: 0 auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.dashboard-header,
.dashboard-tabs,
.form-actions,
.doc-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.dashboard-tabs {
  justify-content: flex-start;
  margin: 14px 0;
  border-bottom: 1px solid var(--line);
}

.tab-btn {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

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

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--soft);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  margin-top: 3px;
  font-size: 20px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 14px;
}

.product-dashboard-grid {
  grid-template-columns: 1fr;
}

.upload-box {
  display: grid;
  grid-template-columns: minmax(260px, 330px) 150px minmax(0, 1fr);
  align-items: end;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.ai-upload-box {
  display: grid;
  grid-template-columns: minmax(260px, 360px) 150px minmax(0, 1fr);
  align-items: end;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.supplier-ai-result {
  overflow-x: auto;
}

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

.ai-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--paper);
}

.stock-print-view {
  display: none;
}

.reports-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 14px;
}

.reports-menu {
  display: grid;
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper);
}

.reports-menu button {
  min-height: 38px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  text-align: left;
  background: #f3f3f3;
}

.reports-menu button:hover,
.reports-menu button.active {
  color: #fff;
  background: var(--accent);
}

.reports-content {
  min-width: 0;
}

.payments-box {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

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

.payment-form button {
  align-self: end;
}

.structures-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 14px;
}

.structures-menu,
.treatments-menu {
  display: grid;
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper);
}

.structures-menu button,
.treatments-menu button {
  min-height: 38px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  text-align: left;
  background: #f3f3f3;
}

.structures-menu button:hover,
.structures-menu button.active,
.treatments-menu button:hover,
.treatments-menu button.active {
  color: #fff;
  background: var(--accent);
}

.treatments-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 14px;
}

.structure-form {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 90px 90px 120px;
  gap: 8px;
  align-items: end;
  margin: 10px 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.compact-structure-form {
  grid-template-columns: 120px minmax(0, 1fr) 90px 120px;
}

.compact-structure-form label:first-of-type {
  display: none;
}

.structure-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.tva-structure-table th {
  color: #1b365d;
  background: #ededed;
  font-weight: 800;
}

.tva-structure-table td {
  padding: 0;
}

.tva-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  color: var(--ink);
  font-size: 16px;
  text-align: right;
  text-transform: none;
}

.tva-row input {
  width: auto;
}

.tva-row span {
  text-align: right;
}

.article-structure-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 12px;
}

.article-family-list {
  display: grid;
  align-self: start;
  max-height: 560px;
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--paper);
}

.article-family-list button {
  min-height: 28px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 4px 8px;
  text-align: left;
  background: #f3f3f3;
}

.article-family-list button.active,
.article-family-list button:hover {
  color: #fff;
  background: var(--accent);
}

.article-structure-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.article-grid-wrap {
  overflow: auto;
  border: 1px solid var(--line);
}

.article-structure-table {
  min-width: 1180px;
}

.article-structure-table th {
  background: #ededed;
  color: #1b365d;
}

.article-structure-table .selected-row td {
  background: #f1f1f1;
}

.article-label-cell {
  max-width: 260px;
  white-space: normal;
  line-height: 1.25;
}

.article-thumb {
  width: 44px;
  height: 28px;
  object-fit: contain;
}

#uploadStatus {
  color: var(--muted);
  font-weight: 700;
}

.product-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
}

.product-form-section {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 8px;
  padding: 10px;
}

.product-form-section h3 {
  margin: 0;
  font-size: 14px;
  color: var(--accent-dark);
}

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

.product-form-fields.single {
  grid-template-columns: 1fr;
}

.field-with-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 6px;
}

.field-with-button button {
  min-height: 34px;
  padding-inline: 8px;
}

.dashboard-list {
  min-width: 0;
}

.dashboard-product-filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 8px;
  align-items: center;
}

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

.dashboard-table th,
.dashboard-table td {
  border: 1px solid var(--line);
  padding: 5px 6px;
  vertical-align: top;
}

.dashboard-table th {
  color: var(--muted);
  background: var(--soft);
  text-align: left;
  text-transform: uppercase;
}

.dashboard-table td {
  overflow-wrap: anywhere;
}

.dashboard-table .row-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.dashboard-documents {
  margin-top: 10px;
}

.doc-filter select,
.doc-filter input {
  max-width: 260px;
}

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

  .catalog-panel {
    position: static;
    max-height: none;
  }

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

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

  .upload-box {
    grid-template-columns: 1fr;
  }

  .ai-upload-box,
  .ai-summary {
    grid-template-columns: 1fr;
  }

  .dashboard-product-filters {
    grid-template-columns: 1fr;
  }

  .reports-layout {
    grid-template-columns: 1fr;
  }

  .reports-menu {
    max-height: 260px;
    overflow: auto;
  }

  .payment-form {
    grid-template-columns: 1fr;
  }

  .structures-layout {
    grid-template-columns: 1fr;
  }

  .structures-menu,
  .treatments-menu {
    max-height: 260px;
    overflow: auto;
  }

  .treatments-layout {
    grid-template-columns: 1fr;
  }

  .structure-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 13px;
  }

  .app-header,
  .invoice-top,
  .client-grid,
  .tax-total-section,
  .invoice-bottom,
  .line-toolbar {
    grid-template-columns: 1fr;
  }

  .app-header {
    display: grid;
    gap: 10px;
    padding: 12px;
  }

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

  .actions button {
    width: 100%;
    min-height: 42px;
  }

  .wide {
    grid-column: auto;
  }

  .client-grid label,
  .client-grid .wide {
    grid-column: auto;
  }

  .invoice-panel {
    padding: 12px;
  }

  .workspace {
    padding: 8px;
    gap: 10px;
  }

  .brand-line {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 12px;
  }

  .company-logo {
    width: 92px;
    height: 60px;
  }

  .company-name {
    font-size: 22px;
  }

  .document-title h2 {
    font-size: 20px;
  }

  .document-title p {
    font-size: 15px;
  }

  .client-grid {
    padding: 8px;
    gap: 8px;
  }

  .client-grid label {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .line-toolbar {
    gap: 6px;
  }

  input,
  select,
  textarea,
  button {
    font-size: 16px;
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .invoice-table {
    min-width: 760px;
  }

  .tax-total-section {
    gap: 10px;
  }

  .tax-table,
  .totals {
    font-size: 12px;
  }

  .signature-block {
    justify-content: center;
  }

  .dashboard {
    padding: 8px;
  }

  .dashboard-panel {
    padding: 10px;
  }

  .dashboard-header {
    align-items: stretch;
  }

  .dashboard-header button {
    width: 100%;
  }

  .product-form {
    grid-template-columns: 1fr;
  }

  .product-form-fields {
    grid-template-columns: 1fr;
  }

  .form-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

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

  .dashboard-list,
  .dashboard-documents {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .login-box {
    padding: 16px;
  }
}

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

  body {
    background: #fff;
    font-family: "Times New Roman", Times, serif;
    font-size: 12px;
    width: 190mm;
    margin: 0 auto;
  }

  .no-print,
  .catalog-panel,
  .app-header,
  .dashboard,
  .login-overlay {
    display: none !important;
  }

  body.print-stock .workspace,
  body.print-report .workspace,
  body.print-stock .invoice-panel {
    display: none !important;
  }

  body.print-stock .stock-print-view {
    display: block !important;
    width: 190mm;
    max-width: 190mm;
    margin: 0 auto;
  }

  body.print-report #reportPrintView {
    display: block !important;
    width: 190mm;
    max-width: 190mm;
    margin: 0 auto;
  }

  body.print-report #stockPrintView {
    display: none !important;
  }

  .stock-print-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1.5px solid #111;
    padding-bottom: 8px;
    margin-bottom: 8px;
  }

  .stock-print-header h1 {
    margin: 0;
    font-size: 22px;
  }

  .stock-print-header p {
    margin: 4px 0 0;
    font-size: 18px;
    font-weight: 700;
  }

  .stock-print-header img {
    width: 95px;
    height: 62px;
    object-fit: contain;
  }

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

  .stock-print-table th,
  .stock-print-table td {
    border: 1px solid #333;
    padding: 4px 6px;
    font-size: 11px;
    vertical-align: top;
    overflow-wrap: anywhere;
  }

  .stock-print-table th {
    background: #e6e6e6;
    text-align: left;
  }

  .workspace {
    display: block;
    padding: 0;
    width: 190mm;
    max-width: 190mm;
    margin: 0 auto;
  }

  .invoice-panel {
    border: 0;
    border-radius: 0;
    padding: 0;
    width: 190mm;
    max-width: 190mm;
  }

  .invoice-top {
    grid-template-columns: minmax(0, 1fr) 245px;
    gap: 16px;
    padding-bottom: 8px;
    border-bottom: 1.5px solid #111;
  }

  .brand-line {
    grid-template-columns: 105px minmax(0, 1fr);
    gap: 12px;
  }

  .company-logo {
    width: 105px;
    height: 68px;
  }

  .company-name {
    font-size: 22px;
    color: #111;
  }

  .document-title {
    margin: 10px 0 12px;
    gap: 3px;
  }

  .document-title h2 {
    font-size: 22px;
    letter-spacing: 0;
  }

  .document-title p {
    font-size: 16px;
  }

  .company-tagline {
    font-size: 12px;
  }

  .brand-block textarea,
  .client-grid,
  .tax-total-section,
  .invoice-bottom {
    margin-top: 8px;
  }

  .invoice-meta,
  .client-grid {
    gap: 6px;
  }

  .invoice-meta {
    padding: 6px 8px;
    border: 1px solid #333;
    border-radius: 6px;
    background: #f6f6f6;
  }

  .client-grid {
    margin: 8px 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px 10px;
    padding: 6px 8px;
    border: 1px solid #333;
    border-radius: 6px;
    background: #f6f6f6;
  }

  .client-grid label {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 4px;
    font-size: 12px;
  }

  .client-grid .wide {
    grid-column: span 2;
  }

  label {
    gap: 2px;
    font-size: 12px;
  }

  input,
  select,
  textarea {
    font-size: 12px;
    line-height: 1.25;
    min-height: 0 !important;
  }

  .invoice-table th,
  .invoice-table td {
    padding: 3px 5px;
    font-size: 11px;
    overflow: hidden;
    border-color: #333;
  }

  .table-wrap {
    display: none !important;
  }

  .invoice-table {
    display: none !important;
  }

  .print-invoice-table {
    display: table;
    width: 100% !important;
    min-width: 0 !important;
    border-collapse: collapse;
    table-layout: fixed;
  }

  .print-invoice-table thead {
    display: table-header-group;
  }

  .print-invoice-table th,
  .print-invoice-table td {
    border: 1px solid #333;
    padding: 3px 5px;
    font-size: 11px;
    vertical-align: top;
    line-height: 1.15;
    overflow-wrap: anywhere;
  }

  .print-invoice-table th {
    color: #111;
    background: #e6e6e6;
    text-align: left;
  }

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

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

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

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

  .print-invoice-table th:nth-child(5),
  .print-invoice-table td:nth-child(5),
  .print-invoice-table th:nth-child(6),
  .print-invoice-table td:nth-child(6) {
    width: 7%;
  }

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

  .print-invoice-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .dashboard-table {
    min-width: 0 !important;
  }

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

  .invoice-table tfoot {
    display: table-footer-group;
  }

  .invoice-table tr,
  .tax-table tr,
  .totals div {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .document-footer-block {
    break-inside: avoid;
    page-break-inside: avoid;
    margin-top: 8px;
  }

  .tax-total-section,
  .amount-words,
  .signature-block {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .invoice-table th {
    font-size: 11px;
    color: #111;
    background: #e6e6e6;
  }

  .invoice-table input,
  .invoice-table textarea,
  .invoice-table select {
    display: none !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    appearance: none;
    padding: 0;
    font-size: 12px;
    line-height: 1.1;
    overflow: hidden;
    min-height: 0 !important;
  }

  .print-value {
    display: block;
    width: 100%;
    color: #111;
    line-height: 1.15;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .print-designation {
    white-space: pre-wrap;
  }

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

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

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

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

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

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

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

  .invoice-table td:nth-child(1) input,
  .invoice-table td:nth-child(3) input,
  .invoice-table td:nth-child(4) input,
  .invoice-table td:nth-child(5) input,
  .invoice-table td:nth-child(6) input,
  .invoice-table td:nth-child(7) {
    text-align: right;
  }

  .invoice-table td:nth-child(2) textarea {
    min-height: 24px;
    line-height: 1.1;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .tax-total-section {
    grid-template-columns: minmax(0, 1fr) 205px;
    gap: 10px;
    margin-top: 6px;
  }

  .invoice-bottom {
    margin-top: 8px;
  }

  .signature-block {
    margin-top: 5px;
    font-size: 12px;
    break-inside: avoid;
  }

  .amount-words {
    margin-top: 5px;
    padding: 4px 6px;
    font-size: 12px;
    line-height: 1.2;
    break-inside: avoid;
    border-color: #333;
    background: #fff;
  }

  .signature-block img {
    width: 130px;
  }

  .totals div {
    padding: 4px 6px;
  }

  .tax-table th,
  .tax-table td {
    padding: 4px 6px;
    font-size: 11px;
    border-color: #333;
  }

  .tax-table th {
    color: #111;
    background: #e6e6e6;
  }

  .totals {
    border-color: #333;
  }

  .totals div {
    border-color: #333;
  }

  .totals div:last-child {
    color: #111;
    background: #e6e6e6;
    font-size: 12px;
  }

  input,
  select,
  textarea {
    border: 0;
    background: transparent;
    padding-left: 0;
  }

  textarea {
    overflow: hidden;
  }
}
