/* ==== Товарный чек: форма слева, живой документ-превью справа; печать/PDF ==== */
.tch{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:22px;align-items:start}
@media (max-width:880px){.tch{grid-template-columns:1fr;gap:16px}}

.tch-form{display:flex;flex-direction:column;gap:14px;min-width:0}
.tch .field{display:flex;flex-direction:column;gap:4px}
.tch .field>span{font-size:.8rem;color:var(--muted);font-weight:600}
.tch input,.tch select{width:100%;height:40px;padding:0 10px;font:inherit;font-size:.95rem;background:var(--bg);color:var(--ink);border:1px solid var(--line-strong);border-radius:var(--radius-sm)}
.tch input:focus,.tch select:focus{outline:none;border-color:var(--accent)}
.tch-grid2{display:grid;grid-template-columns:1fr 1fr;gap:10px}
@media (max-width:480px){.tch-grid2{grid-template-columns:1fr}}

.tch-fs{border:1px solid var(--line);border-radius:var(--radius-sm);padding:12px 14px 14px;margin:0;display:flex;flex-direction:column;gap:10px}
.tch-fs legend{font-weight:700;font-size:.9rem;padding:0 6px;color:var(--ink)}

.tch-numrow{display:flex;gap:8px}
.tch-numrow input{flex:1}
.tch-numrow button{flex:0 0 auto;width:44px;height:40px;font-size:1.1rem;padding:0}

.tch-orgrow{display:flex;gap:8px;align-items:end;flex-wrap:wrap}
.tch-orgrow .field{flex:1;min-width:160px}
.tch-orgrow .btn{height:40px;white-space:nowrap;padding:0 12px;font-size:.85rem}

.tch-goods-head{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;margin-bottom:8px}
.tch-goods-head h3{margin:0;font-size:1rem}
.tch-vat{display:flex;align-items:center;gap:8px}
.tch-vat>span{font-size:.8rem;color:var(--muted);font-weight:600}
.tch-vat select{width:auto;height:36px}

.tch-table-wrap{overflow-x:auto;border:1px solid var(--line);border-radius:var(--radius-sm)}
.tch-input-table{width:100%;border-collapse:collapse;font-size:.9rem;min-width:520px}
.tch-input-table th{background:var(--accent-soft);color:var(--muted);font-weight:600;font-size:.72rem;text-transform:uppercase;letter-spacing:.03em;padding:7px 6px;text-align:left;border-bottom:1px solid var(--line)}
.tch-input-table td{padding:4px 5px;border-bottom:1px solid var(--line);vertical-align:middle}
.tch-input-table tr:last-child td{border-bottom:none}
.tch-input-table input{height:34px;border:1px solid transparent;background:transparent}
.tch-input-table input:hover{border-color:var(--line)}
.tch-input-table input:focus{background:var(--bg);border-color:var(--accent)}
.tch-rn{color:var(--muted);text-align:center;width:26px;font-variant-numeric:tabular-nums}
.tch-c-name{min-width:180px}
.tch-c-unit input{width:64px}
.tch-c-qty input,.tch-c-price input{width:84px;text-align:right}
.tch-c-sum{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap;font-weight:600;padding-right:8px!important}
.tch-del{width:28px;height:28px;border:none;background:transparent;color:var(--muted);border-radius:6px;cursor:pointer;font-size:.95rem;line-height:1}
.tch-del:hover{background:color-mix(in srgb,var(--warn) 16%,transparent);color:var(--warn)}
.tch-goods-actions{display:flex;gap:8px;margin-top:10px}
.tch-goods-actions .btn{padding:0 14px;height:38px;font-size:.88rem}

.tch-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:4px}
.tch-actions .btn{height:46px;padding:0 20px}
.tch-hint{font-size:.82rem;color:var(--muted);line-height:1.5;margin:2px 0 0}
.tch-hint b{color:var(--ink)}

/* ---- логотип ---- */
.tch-logo-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.tch-logo-btn{height:40px;padding:0 14px;font-size:.88rem;cursor:pointer;display:inline-flex;align-items:center}
.tch-logo-prev{max-height:44px;max-width:140px;border:1px solid var(--line);border-radius:6px;background:#fff;padding:3px;object-fit:contain}

/* ---- история чеков ---- */
.tch-hist{margin-top:18px;border:1px solid var(--line);border-radius:var(--radius-sm);background:var(--surface);overflow:hidden}
.tch-hist>summary{cursor:pointer;padding:12px 16px;font-weight:700;list-style:none;display:flex;align-items:center;gap:8px}
.tch-hist>summary::-webkit-details-marker{display:none}
.tch-hist>summary::after{content:"▾";margin-left:auto;color:var(--muted);transition:transform .18s}
.tch-hist[open]>summary::after{transform:rotate(180deg)}
.tch-hist-count{color:var(--muted);font-weight:600;font-size:.9rem}
.tch-hist-list{padding:0 12px 12px;display:flex;flex-direction:column;gap:8px}
.tch-hist-empty{color:var(--muted);font-size:.9rem;padding:6px 4px 10px;line-height:1.5}
.tch-hist-item{display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:10px 12px;border:1px solid var(--line);border-radius:var(--radius-sm);background:var(--bg)}
.tch-hist-info{display:flex;flex-direction:column;gap:2px;min-width:160px;flex:1}
.tch-hist-info b{font-size:.95rem;font-variant-numeric:tabular-nums}
.tch-hist-info span{color:var(--muted);font-size:.84rem;overflow-wrap:anywhere}
.tch-hist-acts{display:flex;gap:6px;flex-wrap:wrap}
.tch-hist-acts button{height:32px;padding:0 12px;border:1px solid var(--line-strong);background:var(--surface);color:var(--ink);border-radius:8px;font:inherit;font-size:.82rem;cursor:pointer}
.tch-hist-acts button:hover{border-color:var(--accent)}
.tch-hist-acts button[data-act="del"]{padding:0 9px}
.tch-hist-acts button[data-act="del"]:hover{border-color:var(--warn);color:var(--warn)}

/* ---- документ-превью (всегда светлый, как на печати) ---- */
.tch-doc-wrap{position:sticky;top:16px}
.tch-doc{background:#fff;color:#14151a;border:1px solid var(--line);border-radius:var(--radius-sm);box-shadow:var(--shadow);
  padding:26px 28px;font:14px/1.5 Arial,"Helvetica Neue",sans-serif;overflow-x:auto}
.tch-doc-top{display:flex;align-items:center;gap:14px;margin-bottom:6px}
.tch-doc-logo{max-height:56px;max-width:150px;object-fit:contain;flex:0 0 auto}
.tch-doc-top .tch-doc-title{flex:1;margin-bottom:0}
.tch-doc-title{text-align:center;font-size:17px;font-weight:700;margin-bottom:4px}
.tch-doc-sub{text-align:center;color:#555;font-size:12px;margin-bottom:16px}
.tch-doc-seller{margin-bottom:14px;font-size:13px;line-height:1.55}
.tch-doc-table{width:100%;border-collapse:collapse;font-size:12.5px;margin-bottom:12px}
.tch-doc-table th,.tch-doc-table td{border:1px solid #333;padding:5px 7px;text-align:left;vertical-align:top}
.tch-doc-table th{background:#f2f2f2;font-weight:700;text-align:center;font-size:11.5px}
.tch-doc-table td.n,.tch-doc-table td.q,.tch-doc-table td.p,.tch-doc-table td.s{text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}
.tch-doc-table td.c{text-align:center}
.tch-doc-table tfoot td{font-weight:700}
.tch-doc-table tfoot .lbl{text-align:right}
.tch-doc-total{font-size:13px;margin:10px 0 2px}
.tch-doc-words{font-size:13px;margin-bottom:20px}
.tch-doc-words b{font-style:italic}
.tch-doc-sign{display:flex;align-items:end;gap:10px;flex-wrap:wrap;font-size:13px;margin-top:26px}
.tch-doc-line{flex:1;min-width:120px;border-bottom:1px solid #333;height:1px;margin-bottom:3px}
.tch-doc-mp{color:#777;border:1px dashed #aaa;border-radius:50%;width:64px;height:64px;display:grid;place-items:center;font-size:11px;margin-left:6px;flex:0 0 auto}
.tch-doc-empty{color:#999;text-align:center;padding:30px 10px;font-style:italic}

.tch-toast{position:fixed;left:50%;bottom:24px;transform:translate(-50%,14px);background:var(--ink);color:var(--bg);padding:10px 16px;border-radius:10px;font-size:.9rem;box-shadow:var(--shadow);opacity:0;pointer-events:none;transition:opacity .2s,transform .2s;z-index:60;max-width:90vw;text-align:center}
.tch-toast.show{opacity:1;transform:translate(-50%,0)}

/* ---- печать: на лист идёт только «портал» документа (копия на уровне body), без пустых страниц ---- */
#tchPrintPortal{display:none}
@media print{
  body{background:#fff!important}
  body>*:not(#tchPrintPortal){display:none!important}
  #tchPrintPortal{display:block;background:#fff;color:#000;font:13px/1.5 Arial,"Helvetica Neue",sans-serif;padding:0}
  #tchPrintPortal .tch-doc-mp{border-color:#999}
  @page{margin:14mm}
}
