/* ==DKCSS-START== editor layout shared by the document tools */
.dk { --dk-ac: var(--brand); }
.dk-tabs { display: none; }
.dk-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr); gap: 20px; align-items: start; }
.dk-form { min-width: 0; }
.dk-view { position: sticky; top: 72px; max-height: calc(100vh - 84px); overflow: auto; background: #e8ebf2; border-radius: 16px; padding: 12px; min-width: 0; overscroll-behavior: contain; }
:root[data-theme="dark"] .dk-view { background: #0b0d13; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .dk-view { background: #0b0d13; } }
.btn.sm { min-height: 36px; padding: 7px 12px; font-size: 14px; border-radius: 9px; }
.dk-toolbar { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; padding: 10px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; }
.dk-tb-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dk-tb-label { font-weight: 700; font-size: 14px; margin-right: 2px; }
.dk-saved { font-size: 13px; color: var(--ok); margin-left: auto; }
.dk-sec { border: 1px solid var(--line); border-radius: 14px; margin: 0 0 10px; background: var(--card); overflow: hidden; }
.dk-sec > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 13px 14px; font-weight: 800; font-size: 16px; min-height: 50px; }
.dk-sec > summary::-webkit-details-marker { display: none; }
.dk-sec > summary::after { content: "▾"; margin-left: auto; color: var(--muted); transition: transform .15s; }
.dk-sec[open] > summary::after { transform: rotate(180deg); }
.dk-sec[open] > summary { border-bottom: 1px solid var(--line); background: var(--bg); }
.dk-sec-ic { width: 30px; height: 30px; display: grid; place-items: center; background: var(--brand-soft); border-radius: 9px; font-size: 16px; flex: none; }
.dk-sec-b { padding: 6px 14px 14px; }
.dk-badge { font-size: 11px; font-weight: 700; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 1px 8px; }
.dk-tip { font-size: 13.5px; color: var(--muted); background: var(--bg); border-radius: 10px; padding: 8px 10px; margin: 8px 0 4px; }
.dk-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.dk-fields .full { grid-column: 1 / -1; }
.dk-fields .field { margin: 8px 0 0; min-width: 0; }
.dk-fields .field label { font-size: 13px; }
.dk-check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; margin: 10px 0 0; cursor: pointer; min-height: 32px; }
.dk-card { border: 1px solid var(--line); border-radius: 12px; padding: 4px 12px 12px; margin: 10px 0; background: var(--bg); }
.dk-card-h { display: flex; align-items: center; gap: 4px; padding-top: 6px; }
.dk-card-t { flex: 1; font-weight: 700; font-size: 14.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dk-ib { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 9px; width: 36px; height: 36px; font-size: 15px; cursor: pointer; flex: none; }
.dk-ib:disabled { opacity: .35; cursor: default; }
.dk-ib.del { color: var(--bad); }
.dk-add { width: 100%; margin-top: 4px; }
.dk-photo { display: flex; gap: 14px; align-items: flex-start; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.dk-photo-img { width: 84px; height: 84px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; flex: none; font-size: 12px; color: var(--muted); }
.dk-photo-img img { width: 100%; height: 100%; object-fit: cover; }
.dk-photo-b { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
.dk-photo-b small { flex-basis: 100%; font-size: 12.5px; }
.dk-photo-b .dk-check { margin: 0; flex-basis: 100%; }
.dk-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.dk-chip { display: inline-flex; align-items: center; gap: 2px; background: var(--brand-soft); color: var(--ink); border-radius: 99px; padding: 3px 4px 3px 12px; font-size: 14px; font-weight: 600; }
.dk-chip button { border: 0; background: transparent; color: var(--muted); cursor: pointer; width: 28px; height: 28px; border-radius: 50%; font-size: 13px; }
.dk-chip-in { display: flex; gap: 8px; }
.dk-chip-in input { flex: 1; min-width: 0; }
.dk-sugg { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.dk-sugg button { font: inherit; font-size: 13px; border: 1px dashed var(--line); background: transparent; color: var(--muted); border-radius: 99px; padding: 5px 10px; cursor: pointer; }
.dk-arrange { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 6px; }
.dk-arrange li { display: flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 6px 8px; }
.dk-arrange input[type=text] { flex: 1; min-width: 0; min-height: 36px; padding: 5px 9px; font-weight: 600; font-size: 14px; }
.dk-ar-ic { width: 22px; text-align: center; flex: none; }
.dk-show { display: flex; align-items: center; gap: 4px; font-size: 12.5px; flex: none; }
.dk-design { background: var(--card); border-radius: 12px; padding: 10px; margin-bottom: 10px; }
.dk-tpls { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.dk-tpls button { flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; border: 2px solid var(--line); background: var(--card); color: var(--ink); border-radius: 11px; padding: 6px 6px 5px; cursor: pointer; font: inherit; font-size: 12.5px; }
.dk-tpls button.on { border-color: var(--dk-ac); box-shadow: 0 0 0 2px color-mix(in srgb, var(--dk-ac) 25%, transparent); }
.dk-tpls b { font-weight: 700; }
.th { position: relative; width: 54px; height: 70px; background: #fff; border: 1px solid #d9dce5; border-radius: 4px; overflow: hidden; display: block; }
.th i { position: absolute; display: block; background: #c9ced9; height: 3px; border-radius: 2px; }
.dk-design-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-top: 8px; }
.dk-swatches { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dk-swatches button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.dk-swatches button.on { box-shadow: 0 0 0 2px var(--ink); }
.dk-color-custom { position: relative; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; border: 1px dashed var(--muted); cursor: pointer; font-size: 14px; }
.dk-color-custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; padding: 0; border: 0; }
.dk-mini { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.dk-mini select { min-height: 34px; padding: 4px 8px; font-size: 14px; width: auto; }
.dk-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 10px; }
.dk-pagecount { font-size: 13px; color: var(--muted); margin-left: auto; }
.dk-pages { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.dk-pages.zoomed { align-items: flex-start; overflow-x: auto; }
.pv-box { position: relative; flex: none; box-shadow: 0 2px 14px rgba(15, 20, 40, .18); background: #fff; overflow: hidden; }
.pv-box > .pg { transform-origin: 0 0; position: absolute; left: 0; top: 0; }
.pv-lab { font-size: 12px; color: var(--muted); margin: 2px 0 10px; }
.dk-hint { font-size: 13.5px; color: var(--muted); background: var(--card); border-radius: 12px; padding: 10px 12px; margin-top: 12px; line-height: 1.5; }
.dk-measure { position: absolute; left: -12000px; top: 0; visibility: hidden; pointer-events: none; contain: layout style; }
#dk-print { display: none; }
.dk-modal { position: fixed; inset: 0; background: rgba(10, 12, 20, .6); z-index: 100; display: grid; place-items: center; padding: 16px; }
.dk-modal-card { background: var(--card); color: var(--ink); border-radius: 16px; padding: 16px; max-width: 360px; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.dk-modal-title { font-weight: 800; }
.dk-crop-cv { touch-action: none; cursor: grab; border-radius: 8px; background: #eee; max-width: 100%; }
.dk-zoom { display: flex; align-items: center; gap: 8px; width: 100%; }
@media (max-width: 900px) {
  .dk-tabs { display: flex; gap: 6px; position: sticky; top: 60px; z-index: 15; background: var(--card); padding: 8px 0; margin: -8px 0 10px; border-bottom: 1px solid var(--line); }
  .dk-tabs button { flex: 1; font: inherit; font-weight: 700; font-size: 15px; min-height: 44px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 11px; cursor: pointer; }
  .dk-tabs button.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
  .dk-tabs .dk-tab-pdf { flex: .8; background: var(--ok); color: #fff; border-color: var(--ok); }
  .dk-grid { grid-template-columns: minmax(0, 1fr); }
  .dk-view { position: static; max-height: none; overflow: visible; margin: 0 -10px; padding: 10px; }
  .dk[data-view="edit"] .dk-view, .dk[data-view="preview"] .dk-form { display: none; }
}
@media (max-width: 420px) {
  .dk-sec-b { padding: 4px 10px 12px; }
  .dk-card { padding: 4px 9px 10px; }
  .dk-actions .btn.big { flex: 1; }
}
@media print {
  html, body { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  body > *:not(#dk-print) { display: none !important; }
  #dk-print { display: block !important; }
  #dk-print .pg { break-after: page; page-break-after: always; transform: none !important; margin: 0 !important; box-shadow: none !important; }
  #dk-print .pg:last-child { break-after: auto; page-break-after: auto; }
}
/* ==DKCSS-END== */

.rc-types { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
.rc-types button { font: inherit; font-size: 14px; font-weight: 600; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 99px; padding: 7px 13px; min-height: 40px; cursor: pointer; }
.rc-types button.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.rc-imgs { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.rc-img { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rc-img-box { width: 100px; height: 52px; border: 1px solid var(--line); border-radius: 9px; background: #fff; display: grid; place-items: center; overflow: hidden; font-size: 12px; color: #777; }
.rc-img-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.th[class*="rth-"] i:nth-child(1) { left: 10%; top: 8px; width: 40%; height: 4px; background: var(--dk-ac); }
.th[class*="rth-"] i:nth-child(2) { left: 10%; top: 16px; width: 80%; }
.th[class*="rth-"] i:nth-child(3) { left: 10%; top: 42px; width: 40%; height: 4px; background: var(--dk-ac); }
.th[class*="rth-"] i:nth-child(4) { left: 10%; top: 50px; width: 80%; }
.th[class*="rth-"]::after { content: ""; position: absolute; left: 4px; right: 4px; top: 34px; border-top: 1px dashed #999; }
.rth-classic { box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 4px var(--dk-ac); }
.rth-modern::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--dk-ac); }

/* ===== receipt page (always light paper) ===== */
.pg { position: relative; overflow: hidden; background: #fff; color: #22262f; font-size: 13px; line-height: 1.45; text-align: left;
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif; -webkit-print-color-adjust: exact; print-color-adjust: exact; color-scheme: light; box-sizing: border-box; }
.pg *, .pg *::before, .pg *::after { box-sizing: border-box; }
.pg-in { position: relative; height: 100%; display: flex; flex-direction: column; padding: 34px 40px; }
.pg-cols { display: flex; flex: 1 1 0; min-height: 0; }
.pg-col { min-width: 0; flex: 1 1 0; min-height: 0; }
.rcs p { margin: 0; }
.rcs.per-2 .r-card { height: calc(50% - .5px); }
.rcs.per-3 .r-card { height: calc(33.333% - .5px); }
.rcs.per-3 { font-size: 12px; }
.rcs .r-card { padding: 12px 0; display: flex; }
.rcs .r-card + .r-card { border-top: 1px dashed #9aa1b0; }
.rcs.per-1 .r-card { padding: 0; height: calc(100% - .5px); align-items: flex-start; }
.rcs.per-1 .r-in { min-height: 46%; }
.rcs .r-in { flex: 1; display: flex; flex-direction: column; padding: 16px 20px; border: 1px solid #cfd4dd; border-radius: 6px; }
.rcs .r-top { display: flex; gap: 14px; align-items: flex-start; padding-bottom: 10px; border-bottom: 2px solid var(--ac); }
.rcs .r-logo { max-width: 90px; max-height: 50px; object-fit: contain; flex: none; }
.rcs .r-from { flex: 1; min-width: 0; }
.rcs .r-fname { font-weight: 800; font-size: 1.25em; color: #12151c; line-height: 1.2; }
.rcs .r-small { font-size: .9em; color: #4a5161; }
.rcs .r-doc { text-align: right; flex: none; }
.rcs .r-title { font-size: 1.3em; font-weight: 800; color: var(--ac); text-transform: uppercase; letter-spacing: .05em; line-height: 1.2; margin-bottom: 2px; }
.rcs .r-text { margin: 12px 0; font-size: 1.05em; line-height: 1.6; flex: 1; }
.rcs .r-text b { font-weight: 700; color: #12151c; }
.rcs .r-bottom { display: flex; gap: 14px; align-items: flex-end; }
.rcs .r-amt { background: var(--ac-soft); border: 1px solid var(--ac); border-radius: 6px; padding: 6px 12px; display: flex; flex-direction: column; flex: none; }
.rcs .r-amt span { font-size: .78em; text-transform: uppercase; letter-spacing: .08em; color: var(--ac-dark); font-weight: 700; }
.rcs .r-amt b { font-size: 1.35em; color: #12151c; }
.rcs .r-meta { border-collapse: collapse; font-size: .9em; flex: 0 1 auto; margin-right: auto; align-self: center; }
.rcs .r-meta th { text-align: left; color: #5b6272; font-weight: 500; padding: 1px 10px 1px 0; white-space: nowrap; vertical-align: top; }
.rcs .r-meta td { font-weight: 600; padding: 1px 0; overflow-wrap: anywhere; }
.rcs .r-stamp { width: 62px; height: 62px; border: 1px dashed #8a91a0; display: grid; place-items: center; text-align: center; font-size: .72em; color: #8a91a0; flex: none; line-height: 1.2; }
.rcs .r-sign { display: flex; flex-direction: column; align-items: center; flex: none; min-width: 150px; }
.rcs .r-sign img { max-width: 150px; max-height: 46px; object-fit: contain; }
.rcs .r-sign-gap { height: 40px; }
.rcs .r-sign-l { border-top: 1px solid #8a91a0; padding-top: 2px; font-size: .85em; color: #4a5161; width: 100%; text-align: center; }

/* Classic: double border */
.rt-classic .r-in { border: 3px double var(--ac); border-radius: 2px; }
.rt-classic .r-top { border-bottom: 1px solid var(--ac); }
/* Modern: accent bar on the left */
.rt-modern .r-in { border: 0; border-left: 8px solid var(--ac); background: #fbfbfd; border-radius: 0 8px 8px 0; box-shadow: inset 0 0 0 1px #e1e4ea; }
.rt-modern .r-top { border-bottom: 1px solid #e1e4ea; }
.rt-modern .r-amt { background: var(--ac); color: var(--ac-ink); border-color: var(--ac); }
.rt-modern .r-amt span, .rt-modern .r-amt b { color: var(--ac-ink); }
/* Minimal: no box, thin rules */
.rt-minimal .r-in { border: 0; padding: 8px 4px; }
.rt-minimal .r-top { border-bottom: 1px solid #22262f; }
.rt-minimal .r-title { color: #12151c; }
.rt-minimal .r-amt { background: none; border: 0; border-left: 3px solid var(--ac); border-radius: 0; }
