
.doc.sheet {
  --gap: 16px;
  --pad: 28px;
  max-height: none;
  overflow: visible;
  border-radius: 0;
  box-shadow: none;
  width: min(100%, 816px);
  margin: 0 auto;
  padding: var(--pad);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
  box-sizing: border-box;
}
.doc.sheet * { box-sizing: border-box; }
.doc.sheet::before { content: none; display: none; }
.doc-head { display: flex; align-items: center; gap: 14px; padding-bottom: 14px; border-bottom: 1px solid color-mix(in srgb, var(--ink) 12%, transparent); }
.doc-head .logo-img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
.doc .co-name { font-size: 15px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }
.doc .co-trade, .doc .co-place { color: color-mix(in srgb, var(--ink) 68%, transparent); font-size: 13px; }
.doc-title-row { display: grid; grid-template-columns: 1.4fr .9fr; gap: 18px; align-items: end; margin: 22px 0 16px; }
.doc-title-row h1 { margin: 0; font-family: var(--font-display, Fraunces, serif); font-size: 42px; line-height: .95; letter-spacing: -0.03em; font-weight: 560; }
.doc-summary { margin: 8px 0 0; max-width: 28rem; color: color-mix(in srgb, var(--ink) 70%, transparent); }
.doc-facts { margin: 0; display: grid; gap: 6px; }
.doc-facts div { display: grid; grid-template-columns: 92px 1fr; gap: 10px; align-items: baseline; }
.doc-facts dt { margin: 0; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: color-mix(in srgb, var(--ink) 62%, transparent); }
.doc-facts dd { margin: 0; font-weight: 600; text-align: right; }
.doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.doc-parties section { padding: 12px 14px; min-height: 88px; border: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); }
.doc-parties h2, .doc-notes h2 { margin: 0 0 8px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.doc-items { width: 100%; border-collapse: collapse; margin: 8px 0 16px; }
.doc-items th, .doc-items td { padding: 9px 8px; vertical-align: top; border-bottom: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); }
.doc-items th { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; text-align: left; }
.doc-items td:first-child { width: 46%; }
.doc-items .num, .doc-items th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc .item-desc { margin-top: 3px; font-size: 12px; color: color-mix(in srgb, var(--ink) 68%, transparent); }
.doc-lower { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; align-items: start; }
.doc-notes p { margin: 0 0 8px; white-space: pre-wrap; }
.doc .totals { width: 100%; }
.doc .totals div { display: grid; grid-template-columns: 1fr auto; gap: 16px; padding: 5px 0; }
.doc .totals .grand { margin-top: 6px; padding-top: 10px; border-top: 2px solid var(--accent); font-size: 18px; font-weight: 700; }
.doc-end { margin-top: 22px; padding-top: 12px; border-top: 1px solid color-mix(in srgb, var(--ink) 12%, transparent); font-size: 12px; color: color-mix(in srgb, var(--ink) 70%, transparent); }
.doc-end .thanks { margin-top: 4px; }

.theme-dark .doc-head, .theme-premium .doc-head, .theme-photo .doc-head { background: #1c1916; color: #f7f3ec; margin: calc(var(--pad) * -1) calc(var(--pad) * -1) 0; padding: 18px var(--pad); }
.theme-dark .co-trade, .theme-dark .co-place, .theme-premium .co-trade, .theme-photo .co-trade { color: #e6d7bf; }
.theme-dark .doc-facts dd, .theme-premium .grand { color: var(--accent); }
.theme-premium .totals .grand { background: #16382c; color: #f6efe4; padding: 12px 12px; }
.theme-minimal .doc-parties section { border: 0; border-top: 1px solid #ddd; padding-left: 0; }
.theme-minimal .doc-title-row h1 { font-size: 36px; }
.theme-photo .doc-head { min-height: 108px; }
.theme-compact { --pad: 16px; --gap: 8px; font-size: 12px; }
.theme-compact .doc-title-row h1 { font-size: 28px; }
.theme-compact .doc-parties section { min-height: 0; padding: 8px; }
.theme-compact .doc-items th, .theme-compact .doc-items td { padding: 5px 6px; }
.theme-icons .doc-parties h2::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; background: var(--accent); border-radius: 99px; }
.theme-wood { background: #f6efe4; }
.theme-wood .doc-head { border-bottom: 3px double #6b4a2e; }
.theme-blue .doc-items thead { background: #1e4f8a; color: #fff; }
.theme-blue .doc-items th { color: #fff; }
.theme-elegant .doc-title-row h1 { font-weight: 500; }
.theme-elegant .doc-parties section { background: #fff; }
.theme-industrial { border-left: 10px solid #1b1d1c; }
.theme-industrial .doc-title-row h1 { text-transform: uppercase; letter-spacing: .04em; font-size: 34px; }
.theme-scandi { --pad: 36px; }
.theme-scandi .doc-parties section { background: #f3f1ea; border: 0; }
.theme-modern .doc-title-row h1 { border-bottom: 3px solid #c4a46a; display: inline-block; }


.doc.sheet, .doc-parties p, .item-desc, .doc-notes p, .co-name, .co-trade {
  overflow-wrap: anywhere;
}
.doc-table-wrap { overflow-x: auto; }
.doc-items td.desc { word-break: break-word; }
@media (max-width: 720px) {
  .doc-table-wrap { overflow: visible; }
  .doc-items, .doc-items tbody, .doc-items tr, .doc-items td { display: block; width: 100%; }
  .doc-items thead { display: none; }
  .doc-items tr { padding: 10px 0 6px; border-bottom: 1px solid color-mix(in srgb, var(--ink) 12%, transparent); }
  .doc-items td { border: 0; padding: 2px 0; }
  .doc-items td.num, .doc-items td[data-label] { display: flex; justify-content: space-between; gap: 12px; text-align: left; white-space: normal; }
  .doc-items td[data-label]:not(.desc)::before { content: attr(data-label); color: color-mix(in srgb, var(--ink) 60%, transparent); font-size: 12px; }
}
@media print {
  .doc-items { display: table; width: 100%; }
  .doc-items thead { display: table-header-group; }
  .doc-items tbody { display: table-row-group; }
  .doc-items tr { display: table-row; }
  .doc-items td, .doc-items th { display: table-cell; }
  .doc-items td[data-label]::before { content: none; }
}

@media (max-width: 720px) {
  .doc.sheet { --pad: 18px; }
  .doc-title-row, .doc-parties, .doc-lower { grid-template-columns: 1fr; }
  .doc-facts div { grid-template-columns: minmax(72px, 38%) 1fr; }
  .doc-facts dd { text-align: left; }
  .doc-title-row h1 { font-size: 32px; }
  .doc-head { align-items: flex-start; }
}
@media print {
  .doc.sheet { width: 8.5in; min-height: 11in; box-shadow: none; }
  .doc-items tr { break-inside: avoid; }
}
