.doc-tools {
  display:grid;
  gap:10px;
  max-width:960px;
  margin:0 auto 16px
}
.doc-bar {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px 12px
}
.doc-back {
  white-space:nowrap;
  margin-right:auto
}
.doc-btn {
  min-height:40px;
  padding:8px 16px;
  border:1px solid var(--line);
  background:#fff;
  color:var(--ink)
}
.doc-btn:hover {
  border-color:var(--ink)
}
.doc-tpl {
  margin-left:auto
}
.doc-tpl-form {
  max-width:480px;
  margin:0
}
.doc-tpl-done {
  margin:0;
  color:var(--muted)
}
.doc-warn {
  max-width:960px;
  margin:0 auto 16px;
  padding:12px 16px;
  border:1px solid var(--red);
  border-radius:10px;
  color:var(--red)
}
.doc {
  max-width:960px;
  margin:0 auto;
  padding:36px 40px;
  background:#fff;
  border-radius:14px;
  box-shadow:0 1px 2px rgba(20,20,20,.06),0 10px 28px -14px rgba(20,20,20,.3)
}
.doc-letterhead {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:24px;
  padding-bottom:16px;
  margin-bottom:22px;
  border-bottom:3px solid #f5c400
}
.doc-logo {
  width:320px;
  max-width:45%;
  height:auto;
  display:block
}
.doc-seller {
  display:grid;
  justify-items:end;
  gap:2px;
  max-width:500px;
  text-align:end;
  font-size:.875rem;
  line-height:1.4
}
.doc-seller b {
  font-size:1rem
}
.doc-seller span {
  color:var(--muted)
}
.doc-head {
  margin-bottom:22px
}
.doc-model {
  margin:0 0 12px;
  font-size:1.5rem;
  line-height:1.3
}
.doc-meta {
  margin:0;
  display:grid;
  gap:6px;
  font-size:1rem
}
.doc-meta div {
  display:grid;
  grid-template-columns:140px minmax(0,1fr);
  gap:8px
}
.doc-meta dt {
  color:var(--muted)
}
.doc-meta dd {
  margin:0;
  font-weight:600
}
.doc-field:empty::before {
  content:attr(data-empty);
  color:var(--muted);
  font-weight:400
}
.doc-actions {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px
}
.doc-hint,.doc-error {
  max-width:960px;
  margin:0 auto 12px;
  font-size:.9375rem
}
.doc-error {
  color:var(--red)
}
/* правка на месте: правимые места видны при наведении, активное - жёлтым */
.doc-field[contenteditable] {
  border-radius:3px;
  outline:1px dashed transparent;
  outline-offset:2px;
  cursor:text
}
.doc-field[contenteditable]:hover {
  outline-color:var(--accent-deep)
}
.doc-field[contenteditable]:focus {
  outline:2px solid var(--accent-deep);
  background:#fffbea
}
.c-p .doc-field[contenteditable],.doc-meta .doc-field[contenteditable] {
  display:inline-block;
  min-width:80px;
  min-height:1.3em
}
.doc-status {
  align-self:center;
  color:var(--muted);
  font-size:.875rem
}
.doc-old {
  color:var(--red)
}
.doc-table {
  width:100%;
  border-collapse:collapse;
  font-size:.9375rem
}
.doc-table th,.doc-table td {
  border:1px solid #cfcfca;
  padding:7px 10px;
  vertical-align:top;
  text-align:start
}
.doc-table th {
  background:#f4f3ef;
  font-weight:700
}
.doc-table .c-n {
  width:56px;
  text-align:center
}
.doc-table .c-p {
  width:150px;
  text-align:end;
  white-space:nowrap;
  font-variant-numeric:tabular-nums
}
.doc-sec td {
  background:#f4f3ef;
  font-weight:700
}
.doc-extra {
  color:var(--muted)
}
.doc-total td {
  font-weight:700
}
.doc-total.last td {
  font-size:1.05rem;
  border-top:2px solid var(--ink)
}
.doc-total.vat td {
  font-weight:400
}
.doc-vat {
  margin-top:12px;
  font-size:.9375rem
}
@media print {
  .doc-field:empty::before {
    content:""
  }
  .doc-letterhead {
    -webkit-print-color-adjust:exact;
    print-color-adjust:exact
  }
  .masthead,.doc-tools,.doc-warn,.doc-hint,.doc-error,#session-error,.skip {
    display:none!important
  }
  /* панели расширений браузера (Drawbridge и др.) в печать не попадают */
  html body>:not(#main) {
    display:none!important
  }
  .doc-field[contenteditable] {
    outline:0!important;
    background:none!important
  }
  .page {
    padding:0;
    max-width:none
  }
  .doc {
    box-shadow:none;
    padding:0;
    max-width:none
  }
  .doc-table tr {
    break-inside:avoid
  }
  .doc-table tfoot {
    display:table-row-group
  }
}
@media(max-width:700px) {
  .doc {
    padding:20px 16px
  }
  .doc-letterhead {
    flex-direction:column;
    align-items:flex-start
  }
  .doc-seller {
    justify-items:start;
    text-align:start
  }
  .doc-meta div {
    grid-template-columns:110px minmax(0,1fr)
  }
}
/* служебные кнопки правки: только на экране и только у последней версии */
.doc-ui {
  display:none
}
.doc-editable .doc-ui {
  display:revert
}
.doc-editable span.doc-ui {
  display:inline
}
.doc-add-line,.doc-add-disc,.doc-del {
  min-height:0;
  margin-inline-start:10px;
  padding:1px 8px;
  border:1px dashed var(--accent-deep);
  border-radius:6px;
  background:none;
  color:var(--accent-deep);
  font-size:.8125rem;
  font-weight:600;
  cursor:pointer
}
.doc-del {
  padding:0 7px;
  border-style:solid;
  border-color:var(--line);
  color:var(--muted)
}
.doc-add-row td {
  border:0!important;
  padding-top:8px!important
}
.doc-add-disc {
  margin:0
}
.doc-total.disc td {
  font-weight:400
}
.doc-lang {
  display:inline-flex;
  border:1px solid var(--line);
  border-radius:8px;
  overflow:hidden
}
.doc-lang a {
  padding:6px 10px;
  text-decoration:none;
  color:var(--muted);
  font-weight:600
}
.doc-lang a.on {
  background:var(--ink);
  color:#fff
}
.doc-adjust {
  max-width:960px;
  margin:0 auto 12px;
  padding:10px 14px;
  border:1px solid var(--line);
  border-radius:10px;
  background:#fff
}
.doc-adjust summary {
  cursor:pointer;
  font-weight:600
}
.adjust-row {
  display:flex;
  flex-wrap:wrap;
  align-items:end;
  gap:10px 14px;
  margin-top:10px
}
.adjust-row label {
  display:grid;
  gap:4px;
  font-size:.875rem;
  color:var(--muted)
}
.adjust-row input {
  width:130px
}
@media print {
  .doc-ui,.doc-adjust {
    display:none!important
  }
}
