.doc-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.doc-list-end { display: flex; gap: 12px; align-items: center; }
.doc-status.draft { color: #445962; background: #edf0f1; }
.doc-status.declined { color: #873c31; background: #f7e8e5; }
.doc-editor .panel { margin-top: 16px; }
.doc-lines { display: grid; gap: 14px; }
.doc-line {
  display: grid;
  grid-template-columns: minmax(155px, 2.6fr) minmax(65px, .75fr) minmax(75px, 1fr) minmax(96px, 1fr) minmax(67px, .7fr) auto;
  gap: 8px;
  align-items: end;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.doc-line .link { align-self: end; }
.doc-add, .doc-edit-total { margin-top: 16px; }
.doc-edit-total { text-align: right; font-size: 1.14rem; }
.doc-xml-note { border: 1px solid #e2d4ab; background: #fff9e6; padding: 12px 16px; margin: 12px 0 16px; border-radius: 8px; }
.doc-xml-note summary { cursor: pointer; font-weight: 650; }
.doc-xml-note p { margin-top: 8px; }
.doc-paper {
  max-width: 950px;
  padding: clamp(20px, 4vw, 54px);
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow-wrap: anywhere;
}
.doc-letter-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 16px; border-bottom: 2px solid #1b4945; padding-bottom: 18px; }
.doc-letter-head strong { font-size: 1.37rem; line-height: 1.25; }
.doc-letter-head small, .doc-address small { color: #4b6266; }
.doc-address { margin: 35px 0; display: grid; white-space: pre-line; }
.doc-address small { margin-bottom: 8px; }
.doc-paper-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 25px; }
.doc-paper-head h2 { font-size: clamp(1.35rem, 2vw, 1.8rem); }
.doc-paper .doc-data div, .doc-summary div { display: flex; justify-content: space-between; align-items: baseline; gap: 1em; }
.doc-data { font-size: .89rem; }
.doc-data dt, .doc-summary dt { color: #485b64; }
.doc-data dd, .doc-summary dd { margin: 0; text-align: right; }
.doc-table-wrap { overflow-x: auto; }
.doc-paper table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .92rem; }
.doc-paper th, .doc-paper td { padding: 9px 6px; text-align: left; vertical-align: top; border-bottom: 1px solid #dce4e2; }
.doc-paper th { background: #eef3f1; }
.doc-paper .doc-num { text-align: right; }
.doc-summary { margin: 18px 0 0 auto; width: min(320px, 100%); }
.doc-summary div { padding: 3px 0; }
.doc-summary div:last-child { border-top: 1px solid #bacbc7; margin-top: 5px; padding-top: 6px; font-weight: 720; }
.doc-note { margin-top: 22px; white-space: pre-wrap; }
.doc-paper footer { padding-top: 12px; margin-top: 35px; border-top: 1px solid #dce4e2; color: #485b64; font-size: .86rem; }
.doc-export-count { margin: 15px 0; }
.delivery-entry { padding: 12px 0; overflow-wrap: anywhere; }
.delivery-entry + .delivery-entry { border-top: 1px solid var(--line); }
.delivery-entry summary { cursor: pointer; font-weight: 650; }
.delivery-entry > div { margin-top: 14px; }
.delivery-proof { margin: 0; }
.delivery-proof dt { color: var(--muted); font-size: .86rem; }
.delivery-proof dd { margin: 2px 0 12px; }
@media (max-width: 1150px) {
  .doc-line { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .doc-line .form-field:first-child { grid-column: 1 / -1; }
  .doc-line .link { grid-column: 1 / -1; justify-self: end; }
}
@media (max-width: 560px) {
  .doc-line { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc-paper { padding: 15px; }
  .doc-paper th, .doc-paper td { padding: 7px 4px; font-size: .85rem; }
  .doc-paper .doc-num { overflow-wrap: normal; }
}
@media print {
  @page { size: A4; margin: 15mm; }
  .doc-paper { border: 0; border-radius: 0; box-shadow: none; max-width: none; padding: 0; color: #152825; }
  .doc-paper table { width: 100%; }
  .doc-paper tr, .doc-summary, .doc-paper footer { break-inside: avoid; }
  .doc-paper .doc-table-wrap { overflow: visible; }
  .doc-paper th { background: #eef3f1; print-color-adjust: exact; }
}
.accounting-sections .panel + .panel { margin-top:0; }
.accounting-sections summary { cursor:pointer; }
@media (max-width:600px) {
  .accounting-sections .data-row { align-items:flex-start; flex-direction:column; }
  .accounting-sections .data-row .pill { white-space:normal; }
}
