/* Cliro V716.0 Fix 001 – clean online document layout. */
:root {
  --cliro-document-ink: #172033;
  --cliro-document-muted: #667085;
  --cliro-document-line: #d9e2ec;
  --cliro-document-soft: #f7f9fc;
  --cliro-document-brand: var(--brand-primary, #12395b);
  --cliro-document-accent: var(--brand-accent, #d99a28);
}

body.cliro-public-document-v716 {
  min-height: 100vh;
  margin: 0;
  background: linear-gradient(180deg, var(--cliro-bg, #edf3f8), var(--cliro-surface-muted, #f7f9fc));
  color: var(--cliro-text, #142033);
}

.cliro-document-portal-head-v018 {
  width: min(calc(100% - 32px), 1120px);
  margin: 18px auto 14px;
  padding: 16px 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  border: 1px solid var(--cliro-border, #d9e2ec);
  border-radius: 18px;
  background: var(--cliro-surface, #fff);
  color: var(--cliro-text, #142033);
  box-shadow: var(--cliro-shadow-md, 0 18px 50px rgba(15, 23, 42, .10));
}

.cliro-document-portal-title-v018 { min-width: 0; }
.cliro-document-portal-meta-v018 { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-bottom: 6px; }
.cliro-document-portal-head-v018 .portal-kicker { color: var(--cliro-primary, #12395b); font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.cliro-document-portal-head-v018 h1 { margin: 0; color: inherit; font-size: 20px; line-height: 1.25; overflow-wrap: anywhere; }
.cliro-document-portal-head-v018 p { margin: 5px 0 0; color: var(--cliro-text-muted, #607086); }
.cliro-document-portal-head-v018 .customer-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin: 0; }
.cliro-document-portal-head-v018 .customer-actions .btn { background: var(--cliro-surface, #fff); color: var(--cliro-text, #142033); border-color: var(--cliro-border-strong, #b9c7d5); }
.cliro-document-portal-head-v018 .customer-actions .btn.primary { background: var(--cliro-primary, #12395b); color: var(--cliro-primary-text, #fff); border-color: var(--cliro-primary, #12395b); }
.cliro-document-portal-head-v018 .customer-actions .btn.danger { background: transparent; color: var(--cliro-danger, #b42318); border-color: color-mix(in srgb, var(--cliro-danger, #b42318) 48%, var(--cliro-border, #d9e2ec)); }

.cliro-document-status-v018 {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--cliro-surface-strong, #edf2f7);
  color: var(--cliro-text, #142033);
  font-size: 11px;
  font-weight: 900;
}
.cliro-document-status-v018.is-open { background: #fff3d6; color: #854d0e; }
.cliro-document-status-v018.is-viewed { background: #e0f2fe; color: #075985; }
.cliro-document-status-v018.is-accepted { background: #dcfae6; color: #067647; }
.cliro-document-status-v018.is-declined { background: #fee4e2; color: #b42318; }

.customer-page,
.cliro-document-preview-v018,
.cliro-document-preview-v019 {
  box-sizing: border-box;
  width: min(100%, 1120px);
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 18px 44px;
}

.customer-page > .doc-sheet,
.cliro-document-preview-v018 > .doc-sheet,
.cliro-document-preview-v019 > .doc-sheet,
body.cliro-v716 .doc-sheet.doc-sheet-long {
  position: relative;
  display: block;
  box-sizing: border-box;
  width: min(100%, 920px);
  min-width: 0;
  max-width: 920px;
  min-height: 0;
  margin: 0 auto;
  padding: 0 0 30px;
  overflow: hidden;
  border: 1px solid #d4dde8;
  border-radius: 18px;
  background: #fff;
  color: var(--cliro-document-ink);
  color-scheme: light;
  box-shadow: 0 26px 74px rgba(15, 23, 42, .15);
}

.doc-sheet .doc-head-block {
  position: static;
  height: auto;
  margin: 0 0 26px;
  padding: 36px 40px 28px;
  background: linear-gradient(135deg, #fff, #f7fafc);
  border-bottom: 1px solid #e5ebf2;
}

.doc-sheet .doc-brand-row {
  position: static;
  display: grid;
  grid-template-columns: minmax(120px, 160px) minmax(0, 1fr) minmax(170px, 210px);
  width: 100%;
  height: auto;
  gap: 24px;
  align-items: start;
}
.doc-sheet .doc-brand-row.no-logo {
  grid-template-columns: minmax(0, 1fr) minmax(170px, 210px);
}

.doc-sheet .doc-brand-left,
.doc-sheet .doc-brand-main,
.doc-sheet .doc-docdata {
  position: static;
  inset: auto;
  display: block;
  width: auto;
  min-width: 0;
  max-width: none;
  padding: 0;
  margin: 0;
}

.doc-sheet .doc-brand-left { min-height: 64px; display: flex; align-items: flex-start; }
.doc-sheet .doc-logo { display: block; width: auto; height: auto; max-width: 160px; max-height: 78px; object-fit: contain; object-position: left top; background: transparent; }
.doc-sheet .doc-logo-fallback-v019 { color: var(--cliro-document-brand); font-size: 17px; font-weight: 900; line-height: 1.2; overflow-wrap: anywhere; }
.doc-sheet .doc-company { margin: 0; color: #111827; font-size: 22px; font-weight: 900; line-height: 1.15; overflow-wrap: anywhere; }
.doc-sheet .doc-sub { margin-top: 5px; color: #344054; font-size: 13px; font-weight: 700; line-height: 1.35; }
.doc-sheet .doc-addr { margin-top: 8px; color: #667085; font-size: 12px; line-height: 1.45; }
.doc-sheet .doc-docdata { text-align: right; }
.doc-sheet .doc-kind-badge { display: inline-flex; max-width: 100%; padding: 7px 11px; border-radius: 999px; background: var(--cliro-document-brand); color: #fff; font-size: 11px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; white-space: normal; text-align: center; }
.doc-sheet .doc-number { margin: 10px 0 12px; color: #111827; font-size: 17px; font-weight: 900; overflow-wrap: anywhere; }
.doc-sheet .doc-docdata dl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; margin: 0; }
.doc-sheet .doc-docdata dt { margin: 0; color: #667085; font-size: 10px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; text-align: left; }
.doc-sheet .doc-docdata dd { margin: 0; color: #111827; font-size: 12px; font-weight: 800; text-align: right; white-space: nowrap; }

.doc-sheet .doc-recipient-block,
.doc-sheet .doc-title,
.doc-sheet .salutation,
.doc-sheet .items-section,
.doc-sheet .document-content,
.doc-sheet .payment-final-block,
.doc-sheet .tax-note,
.doc-sheet .notes-render,
.doc-sheet .attachments,
.doc-sheet .closing {
  margin-left: 40px;
  margin-right: 40px;
}

.doc-sheet .doc-recipient-block { margin-top: 0; margin-bottom: 24px; padding: 0; }
.doc-sheet .recipient { color: #172033; font-size: 13px; line-height: 1.5; }
.doc-sheet .sender-line { margin-bottom: 12px; padding-bottom: 6px; border-bottom: 1px solid #d9e2ec; color: #667085; font-size: 10px; }
.doc-sheet .doc-label { margin-bottom: 8px; color: #667085; font-size: 10px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.doc-sheet .doc-title { margin-top: 0; margin-bottom: 12px; color: #111827; font-size: 29px; line-height: 1.16; letter-spacing: -.035em; }
.doc-sheet .salutation { margin-top: 0; margin-bottom: 24px; color: #475467; font-size: 14px; line-height: 1.55; }
.doc-sheet .items-section { margin-top: 0; margin-bottom: 28px; padding: 0; }

/* Legacy scroll wrappers are removed by PHP/JS. This keeps the view clean before JS runs. */
.doc-sheet .cliro-table-scroll,
.doc-sheet .cliro-table-scroll-007,
.doc-sheet .table-scroll,
.doc-sheet .table-wrap,
.doc-sheet [role="region"][aria-label*="Tabelle horizontal"],
.doc-sheet [role="region"][aria-label*="horizontally scrollable"] {
  display: contents;
}

.doc-sheet table {
  width: 100%;
  max-width: 100%;
  margin: 0;
  border-spacing: 0;
  border-collapse: collapse;
  background: #fff;
  color: #172033;
  box-shadow: none;
}
.doc-sheet table thead:empty,
.doc-sheet table thead:not(:has(th, td)) { display: none; }
.doc-sheet table tbody tr,
.doc-sheet table tbody tr:nth-child(even),
.doc-sheet table tbody tr:hover { background: #fff; }

.doc-sheet .pos-table,
.doc-sheet .pos-table-compact {
  display: table;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  table-layout: fixed;
  border: 1px solid #d9e2ec;
  border-radius: 0;
  overflow: visible;
  font-size: 13px;
}
.doc-sheet .pos-table thead,
.doc-sheet .pos-table-compact thead { display: table-header-group; }
.doc-sheet .pos-table th,
.doc-sheet .pos-table-compact th {
  padding: 11px 13px;
  border: 0;
  background: var(--cliro-document-brand);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .045em;
  text-transform: uppercase;
  text-align: left;
}
.doc-sheet .pos-table th:nth-child(1), .doc-sheet .pos-table td:nth-child(1) { width: 52%; }
.doc-sheet .pos-table th:nth-child(2), .doc-sheet .pos-table td:nth-child(2) { width: 16%; text-align: right; }
.doc-sheet .pos-table th:nth-child(3), .doc-sheet .pos-table td:nth-child(3) { width: 10%; text-align: right; }
.doc-sheet .pos-table th:nth-child(4), .doc-sheet .pos-table td:nth-child(4) { width: 22%; text-align: right; }
.doc-sheet .pos-table td,
.doc-sheet .pos-table-compact td {
  display: table-cell;
  padding: 13px;
  border: 0;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
  color: #172033;
  vertical-align: top;
  line-height: 1.45;
}
.doc-sheet .pos-table td::before,
.doc-sheet .pos-table-compact td::before { content: none; display: none; }
.doc-sheet .pos-table td.num,
.doc-sheet .pos-table-compact td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc-sheet .pos-table td strong { color: #111827; font-weight: 850; }
.doc-sheet .position-desc-row td { padding: 11px 13px 14px; background: #f8fafc; color: #475467; }
.doc-sheet .position-desc-inline { margin: 0; color: inherit; font-size: 12px; line-height: 1.55; }

/* Rich-text tables inside descriptions: one table, no nested frame, readable wrapping. */
.doc-sheet .desc-html table:not(.pos-table),
.doc-sheet .flow-content table,
.doc-sheet .notes-render table {
  table-layout: auto;
  margin: 12px 0;
  border-top: 1px solid #d9e2ec;
  border-bottom: 1px solid #d9e2ec;
  font-size: 12px;
}
.doc-sheet .desc-html table:not(.pos-table) th,
.doc-sheet .flow-content table th,
.doc-sheet .notes-render table th {
  padding: 10px 11px;
  border: 0;
  border-bottom: 1px solid #cbd5e1;
  background: #eef3f7;
  color: #344054;
  font-weight: 850;
  text-align: left;
}
.doc-sheet .desc-html table:not(.pos-table) td,
.doc-sheet .flow-content table td,
.doc-sheet .notes-render table td {
  min-width: 0;
  padding: 10px 11px;
  border: 0;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
  color: #344054;
  vertical-align: top;
  overflow-wrap: anywhere;
}
.doc-sheet .desc-html table:not(.pos-table) tr:last-child td,
.doc-sheet .flow-content table tr:last-child td,
.doc-sheet .notes-render table tr:last-child td { border-bottom: 0; }

.doc-sheet .payment-final-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
  width: auto;
  max-width: none;
  gap: 30px;
  align-items: start;
  margin-top: 0;
  margin-bottom: 24px;
  padding: 26px 0 0;
  border-top: 1px solid #e5e7eb;
  background: transparent;
  overflow: visible;
}
.doc-sheet .payment-info,
.doc-sheet .payment-summary { display: block; width: auto; min-width: 0; padding: 0; margin: 0; background: transparent; border: 0; box-shadow: none; }
.doc-sheet .payment-info h2 { margin: 0 0 12px; color: #111827; font-size: 19px; }
.doc-sheet .payment-info h3 { margin: 14px 0 6px; color: #475467; font-size: 11px; text-transform: uppercase; letter-spacing: .045em; }
.doc-sheet .payment-info p { margin: 0 0 10px; color: #475467; font-size: 13px; line-height: 1.55; }

/* Clean totals in light and dark mode: no dark filled card inside the paper. */
.doc-sheet .document-total-list-v018 {
  display: block;
  width: 100%;
  max-width: 420px;
  margin: 0 0 0 auto;
  padding: 4px 0;
  overflow: visible;
  border: 0;
  border-top: 1px solid #cfd8e3;
  border-bottom: 1px solid #cfd8e3;
  border-radius: 0;
  background: transparent;
  color: #172033;
  box-shadow: none;
}
.doc-sheet .document-total-row-v018 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 18px;
  padding: 9px 0;
  border: 0;
  border-bottom: 1px solid #e5e7eb;
  background: transparent;
}
.doc-sheet .document-total-row-v018:last-child { border-bottom: 0; }
.doc-sheet .document-total-row-v018 dt { margin: 0; color: #475467; font-size: 13px; font-weight: 700; line-height: 1.35; }
.doc-sheet .document-total-row-v018 dd { margin: 0; color: #111827; font-size: 13px; font-weight: 800; line-height: 1.35; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc-sheet .document-total-row-v018 dd strong { color: inherit; font-weight: inherit; }
.doc-sheet .document-total-row-v018.total-gross {
  margin-top: 3px;
  padding: 13px 0 10px;
  border-top: 2px solid #111827;
  border-bottom: 0;
  background: transparent;
}
.doc-sheet .document-total-row-v018.total-gross dt,
.doc-sheet .document-total-row-v018.total-gross dd {
  color: #111827;
  font-size: 15px;
  font-weight: 900;
}

.doc-sheet .payment-public-note { max-width: 420px; margin: 14px 0 0 auto; padding: 12px 14px; border: 1px solid #d9e2ec; border-radius: 12px; background: #f8fafc; color: #475467; font-size: 12px; line-height: 1.5; }
.doc-sheet .sepa-payment-code.compact {
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-top: 12px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.doc-sheet .sepa-payment-code.compact .sepa-payment-qr {
  width: 92px;
  height: 92px;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #fff;
}
.doc-sheet .sepa-payment-code.compact .sepa-payment-qr svg,
.doc-sheet .sepa-payment-code.compact .sepa-payment-qr img {
  width: 92px;
  height: 92px;
  margin: 0;
}
.doc-sheet .tax-note,
.doc-sheet .notes-render { color: #475467; font-size: 13px; line-height: 1.55; }
.doc-sheet .closing { color: #475467; font-size: 13px; line-height: 1.55; }
.doc-sheet .doc-footer { position: static; inset: auto; width: auto; margin: 30px 40px 0; padding: 16px 0 0; border-top: 1px solid #d9e2ec; color: #667085; font-size: 10px; line-height: 1.45; }
.doc-sheet .doc-footer span { display: block; margin-bottom: 3px; }

.preview-actions-v018,
.preview-info-bubbles,
.document-check-v018,
.accept-box,
.cliro-public-document-v716 .success,
.cliro-public-document-v716 .notice,
.cliro-public-document-v716 .error {
  width: min(calc(100% - 32px), 1120px);
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
}
.preview-actions-v018 { position: sticky; top: 10px; z-index: 500; display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; padding: 12px 14px; border: 1px solid var(--cliro-border, #d9e2ec); border-radius: 16px; background: var(--cliro-surface, #fff); color: var(--cliro-text, #142033); box-shadow: var(--cliro-shadow-md, 0 12px 34px rgba(15,23,42,.08)); }
.preview-info-bubbles { display: grid; grid-template-columns: minmax(160px, .65fr) minmax(300px, 1.8fr) minmax(140px, .55fr); gap: 10px; margin-bottom: 14px; }
.preview-info-bubble { min-width: 0; padding: 12px 14px; border: 1px solid var(--cliro-border, #d9e2ec); border-radius: 14px; background: var(--cliro-surface, #fff); color: var(--cliro-text, #142033); }
.preview-info-bubble-wide { grid-column: auto; }
.preview-info-bubble-note { grid-column: 1 / -1; }
.preview-info-link { overflow-wrap: anywhere; }
html.cliro-theme-dark .preview-info-bubble .preview-info-label { color: var(--cliro-text-muted, #b8c7d9); }
html.cliro-theme-dark .preview-info-bubble .preview-info-value { color: var(--cliro-text, #f4f8fc); }
.document-check-v018 { box-sizing: border-box; margin-top: 12px; margin-bottom: 12px; padding: 14px 16px; border: 1px solid #b7e4ca; border-radius: 14px; background: #ecfdf3; color: #065f46; }
.document-check-v018.has-warning { border-color: #fedf89; background: #fffaeb; color: #7a2e0e; }
.document-check-v018.has-error { border-color: #fecdca; background: #fef3f2; color: #912018; }
.accept-box { box-sizing: border-box; padding: 24px; border: 1px solid var(--cliro-border, #d9e2ec); border-radius: 18px; background: var(--cliro-surface, #fff); color: var(--cliro-text, #142033); box-shadow: var(--cliro-shadow-md, 0 16px 46px rgba(15,23,42,.10)); }
.confirm-box { display: flex; align-items: flex-start; gap: 10px; padding: 13px 14px; border: 1px solid var(--cliro-border, #d9e2ec); border-radius: 12px; background: var(--cliro-surface-muted, #f8fafc); }
.signature-pad { width: 100%; max-width: 100%; border: 2px dashed var(--cliro-border-strong, #aab8c8); border-radius: 12px; background: #fff; touch-action: none; }

html.cliro-theme-dark body.cliro-public-document-v716 {
  background: linear-gradient(180deg, #06111c, #0b1a29 260px, #07121e);
  color: #f4f8fc;
}
html.cliro-theme-dark body.cliro-public-document-v716 .cliro-document-portal-head-v018,
html.cliro-theme-dark body.cliro-public-document-v716 .accept-box {
  background: #102231;
  border-color: #2f4a5f;
  color: #f4f8fc;
  box-shadow: 0 20px 58px rgba(0, 0, 0, .30);
}
html.cliro-theme-dark body.cliro-public-document-v716 .cliro-document-portal-head-v018 p,
html.cliro-theme-dark body.cliro-public-document-v716 .accept-box .muted { color: #b8c7d5; }
html.cliro-theme-dark body.cliro-public-document-v716 .customer-actions .btn { background: #142b40; border-color: #3a556c; color: #f8fafc; }
html.cliro-theme-dark body.cliro-public-document-v716 .customer-actions .btn.primary { background: var(--cliro-primary, #8fc7f0); border-color: var(--cliro-primary, #8fc7f0); color: var(--cliro-primary-text, #07131d); }
html.cliro-theme-dark body.cliro-public-document-v716 .customer-actions .btn.danger { background: #3a1820; border-color: #8f3543; color: #ffd7dc; }
html.cliro-theme-dark body.cliro-public-document-v716 .confirm-box { background: #0b1b2b; border-color: #39556d; color: #edf3f8; }
html.cliro-theme-dark body.cliro-public-document-v716 input.input,
html.cliro-theme-dark body.cliro-public-document-v716 textarea.input,
html.cliro-theme-dark body.cliro-public-document-v716 select.input { background: #081725; border-color: #3a566d; color: #fff; }

/* The document remains a light paper surface, including totals, in dark mode. */
html.cliro-theme-dark body.cliro-v716 .doc-sheet {
  background: #fff;
  color: #172033;
  border-color: #7890a5;
  box-shadow: 0 28px 84px rgba(0, 0, 0, .40);
  color-scheme: light;
}
html.cliro-theme-dark body.cliro-v716 .doc-sheet .document-total-list-v018,
html.cliro-theme-dark body.cliro-v716 .doc-sheet .document-total-row-v018 {
  background: transparent;
  color: #172033;
}

@media (max-width: 900px) {
  .cliro-document-portal-head-v018 { grid-template-columns: 1fr; }
  .cliro-document-portal-head-v018 .customer-actions { justify-content: stretch; }
  .cliro-document-portal-head-v018 .customer-actions .btn { flex: 1 1 180px; justify-content: center; }
  .preview-info-bubbles { grid-template-columns: 1fr 1fr; }
  .preview-info-bubble-note,
  .preview-info-bubble-wide { grid-column: 1 / -1; }
  .doc-sheet .payment-final-block { grid-template-columns: 1fr; }
  .doc-sheet .document-total-list-v018 { max-width: none; }
}

@media (max-width: 680px) {
  .cliro-document-portal-head-v018,
  .preview-actions-v018,
  .preview-info-bubbles,
  .document-check-v018,
  .accept-box,
  .cliro-public-document-v716 .success,
  .cliro-public-document-v716 .notice,
  .cliro-public-document-v716 .error { width: 100%; border-left: 0; border-right: 0; border-radius: 0; }
  .cliro-document-portal-head-v018 { margin-top: 0; padding: 14px; }
  .cliro-document-portal-head-v018 .customer-actions { display: grid; grid-template-columns: 1fr; }
  .customer-page,
  .cliro-document-preview-v018,
  .cliro-document-preview-v019 { width: 100%; padding: 0 0 24px; }
  .customer-page > .doc-sheet,
  .cliro-document-preview-v018 > .doc-sheet,
  .cliro-document-preview-v019 > .doc-sheet,
  body.cliro-v716 .doc-sheet.doc-sheet-long { width: 100%; max-width: none; border-left: 0; border-right: 0; border-radius: 0; box-shadow: none; }
  .doc-sheet .doc-head-block { padding: 24px 18px 20px; }
  .doc-sheet .doc-brand-row { grid-template-columns: 1fr; gap: 18px; }
  .doc-sheet .doc-brand-left { min-height: 48px; }
  .doc-sheet .doc-logo { max-width: 150px; max-height: 66px; }
  .doc-sheet .doc-docdata { text-align: left; }
  .doc-sheet .doc-docdata dl { grid-template-columns: minmax(0, 1fr) auto; }
  .doc-sheet .doc-docdata dt { text-align: left; }
  .doc-sheet .doc-docdata dd { text-align: right; }
  .doc-sheet .doc-recipient-block,
  .doc-sheet .doc-title,
  .doc-sheet .salutation,
  .doc-sheet .items-section,
  .doc-sheet .document-content,
  .doc-sheet .payment-final-block,
  .doc-sheet .tax-note,
  .doc-sheet .notes-render,
  .doc-sheet .attachments,
  .doc-sheet .closing { margin-left: 16px; margin-right: 16px; }
  .doc-sheet .doc-title { font-size: 25px; }

  .doc-sheet .pos-table,
  .doc-sheet .pos-table-compact,
  .doc-sheet .pos-table tbody,
  .doc-sheet .pos-table-compact tbody { display: block; width: 100%; min-width: 0; max-width: 100%; border: 0; }
  .doc-sheet .pos-table thead,
  .doc-sheet .pos-table-compact thead { display: none; }
  .doc-sheet .pos-table .position-main-row,
  .doc-sheet .pos-table-compact .position-main-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 0; border: 1px solid #d9e2ec; border-bottom: 0; background: #fff; }
  .doc-sheet .pos-table td,
  .doc-sheet .pos-table-compact td { display: flex; flex-direction: column; align-items: flex-end; width: auto; min-width: 0; padding: 10px 12px; justify-content: flex-start; gap: 4px; border-bottom: 1px solid #e5e7eb; text-align: right; white-space: normal; }
  .doc-sheet .pos-table .position-main-row td,
  .doc-sheet .pos-table-compact .position-main-row td { width: auto; min-width: 0; }
  .doc-sheet .pos-table td::before,
  .doc-sheet .pos-table-compact td::before { content: attr(data-label); display: block; width: 100%; color: #667085; font-size: 10px; font-weight: 850; letter-spacing: .035em; text-transform: uppercase; text-align: right; }
  .doc-sheet .pos-table td:first-child,
  .doc-sheet .pos-table-compact td:first-child { grid-column: 1 / -1; display: block; width: auto; text-align: left; }
  .doc-sheet .pos-table td:first-child::before,
  .doc-sheet .pos-table-compact td:first-child::before { margin-bottom: 6px; text-align: left; }
  .doc-sheet .pos-table .position-desc-row,
  .doc-sheet .pos-table-compact .position-desc-row { display: block; margin-bottom: 14px; border: 1px solid #d9e2ec; border-top: 0; }
  .doc-sheet .pos-table .position-desc-row td,
  .doc-sheet .pos-table-compact .position-desc-row td { display: block; width: 100%; border: 0; text-align: left; }
  .doc-sheet .pos-table .position-desc-row td::before,
  .doc-sheet .pos-table-compact .position-desc-row td::before { content: none; display: none; }

  .doc-sheet .desc-html table:not(.pos-table),
  .doc-sheet .flow-content table,
  .doc-sheet .notes-render table { display: block; max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
  .doc-sheet .desc-html table:not(.pos-table) tbody,
  .doc-sheet .flow-content table tbody,
  .doc-sheet .notes-render table tbody { display: table; width: 100%; min-width: 520px; }

  .doc-sheet .document-total-row-v018 { gap: 12px; }
  .doc-sheet .document-total-row-v018 dt { overflow-wrap: anywhere; }
  .doc-sheet .sepa-payment-code.compact { grid-template-columns: 84px minmax(0, 1fr); gap: 12px; text-align: left; }
  .doc-sheet .sepa-payment-code.compact .sepa-payment-qr,
  .doc-sheet .sepa-payment-code.compact .sepa-payment-qr svg,
  .doc-sheet .sepa-payment-code.compact .sepa-payment-qr img { width: 84px; height: 84px; }
  .doc-sheet .doc-footer { margin: 26px 16px 0; }
  .preview-actions-v018 { position: static; overflow: visible; }
  .preview-info-bubbles { grid-template-columns: 1fr; }
  .preview-info-bubble,
  .preview-info-bubble-wide,
  .preview-info-bubble-note { grid-column: auto; }
}

@media print {
  .cliro-document-portal-head-v018,
  .preview-actions-v018,
  .preview-info-bubbles,
  .document-check-v018 { display: none; }
  .customer-page,
  .cliro-document-preview-v018,
  .cliro-document-preview-v019 { width: auto; max-width: none; padding: 0; }
  .customer-page > .doc-sheet,
  .cliro-document-preview-v018 > .doc-sheet,
  .cliro-document-preview-v019 > .doc-sheet { border: 0; border-radius: 0; box-shadow: none; }
}
