/* =========================================================
   RESULT CLONE 1..4 — V8
   Visual/export layer only. Existing OCR/formula logic untouched.
   ========================================================= */
.clone-result-tools{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  margin:10px 0 4px;
  padding:9px 10px;
  border:1px solid #e1e7f0;
  border-radius:12px;
  background:#f8fafc;
}
.clone-result-tools .clone-label{
  font-size:12px;
  font-weight:900;
  color:#344054;
  margin-right:2px;
}
.clone-count-group{display:flex;gap:5px;align-items:center}
.clone-count-btn{
  min-width:34px!important;
  height:34px!important;
  min-height:34px!important;
  padding:0 10px!important;
  border-radius:9px!important;
  border:1px solid #d7deea!important;
  background:#fff!important;
  color:#344054!important;
  font-size:13px!important;
  font-weight:900!important;
  box-shadow:none!important;
}
.clone-count-btn.active{
  background:#4f46e5!important;
  border-color:#4f46e5!important;
  color:#fff!important;
}
.clone-export-spacer{flex:1}
.clone-export-btn{
  min-height:34px!important;
  height:34px!important;
  padding:0 11px!important;
  border-radius:9px!important;
  font-size:12px!important;
  font-weight:900!important;
  white-space:nowrap;
}

.clone-result-section{
  margin-top:14px;
  padding-top:14px;
  border-top:1px solid #e6eaf1;
}
.clone-result-section[hidden]{display:none!important}
.clone-result-section-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-bottom:10px;
}
.clone-result-section-head b{font-size:13px;color:#1f2937}
.clone-result-section-head small{font-size:11px;color:#667085}
.clone-result-scroll{
  width:100%;
  overflow-x:auto;
  overflow-y:hidden;
  padding:10px;
  border:1px solid #e2e8f0;
  border-radius:14px;
  background:#fff;
  -webkit-overflow-scrolling:touch;
}
.clone-result-canvas{
  display:flex;
  align-items:flex-start;
  justify-content:center;
  gap:8px;
  width:max-content;
  min-width:100%;
  margin:0 auto;
  background:#fff;
}
.clone-result-copy{
  flex:0 0 auto;
  position:relative;
  overflow:visible;
}
.clone-result-copy .clone-copy-card{
  margin:0!important;
  transform-origin:top left;
}
.clone-result-copy .clone-copy-card [contenteditable="true"]{
  cursor:default!important;
  outline:none!important;
}
.clone-result-copy-number{
  position:absolute;
  z-index:20;
  top:5px;
  right:5px;
  width:20px;
  height:20px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:999px;
  background:rgba(17,24,39,.78);
  color:#fff;
  font:800 10px/1 Arial,sans-serif;
  pointer-events:none;
}

/* Export mode has no scroll border/padding and keeps a clean white canvas. */
.clone-result-canvas.clone-exporting{
  min-width:0!important;
  width:max-content!important;
  padding:12px!important;
  gap:6px!important;
  background:#fff!important;
}
.clone-result-canvas.clone-exporting .clone-result-copy-number{display:none!important}

@media(max-width:768px){
  .clone-result-tools{gap:6px;padding:8px}
  .clone-result-tools .clone-label{width:100%;margin-bottom:1px}
  .clone-export-spacer{display:none}
  .clone-export-btn{flex:1 1 120px}
  .clone-result-scroll{padding:7px}
  .clone-result-canvas{justify-content:flex-start;gap:6px}
}

@media(max-width:420px){
  .clone-count-btn{min-width:32px!important;padding:0 9px!important}
  .clone-result-section-head{align-items:flex-start;flex-direction:column;gap:2px}
}

/* =========================================================
   V9 — CLONE FULL ROW / FULL DIVIDER FIX
   Make every label/value divider touch the row edges exactly.
   Visual-only; result/OCR formulas are unchanged.
   ========================================================= */
.clone-copy-card .r,
.clone-copy-card .mini-row,
.clone-copy-card .compact-row,
.clone-copy-card .seq19-row,
.clone-copy-card .t130-row,
.clone-copy-card .t130-mini{
  align-items:stretch!important;
  box-sizing:border-box!important;
}

.clone-copy-card .left,
.clone-copy-card .mini-label,
.clone-copy-card .compact-row > div:first-child,
.clone-copy-card .seq19-index,
.clone-copy-card .t130-label,
.clone-copy-card .t130-mini > b{
  align-self:stretch!important;
  height:auto!important;
  min-height:100%!important;
  box-sizing:border-box!important;
  margin:0!important;
}

/* The old mini rows sometimes leave a tiny 1px gap at the bottom after
   clone scaling. Draw the divider as a full-height edge on the cell. */
.clone-copy-card .mini-row{
  position:relative!important;
  grid-template-columns:61px minmax(0,1fr)!important;
}
.clone-copy-card .mini-row > .mini-label{
  border-right:0!important;
  position:relative!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  line-height:1!important;
}
.clone-copy-card .mini-row > .mini-label::after{
  content:"";
  position:absolute;
  top:0;
  bottom:0;
  right:-1px;
  width:1px;
  background:#555;
  pointer-events:none;
}

/* Same treatment for numbered 1..19 rows and compact B/C/D/F/I/N rows. */
.clone-copy-card .seq19-row{
  position:relative!important;
}
.clone-copy-card .seq19-index{
  border-right:0!important;
  position:relative!important;
}
.clone-copy-card .seq19-index::after{
  content:"";
  position:absolute;
  top:0;
  bottom:0;
  right:-1px;
  width:1px;
  background:#777;
  pointer-events:none;
}
.clone-copy-card .compact-row{
  position:relative!important;
}
.clone-copy-card .compact-row > div:first-child{
  border-right:0!important;
  position:relative!important;
}
.clone-copy-card .compact-row > div:first-child::after{
  content:"";
  position:absolute;
  top:0;
  bottom:0;
  right:-1px;
  width:1px;
  background:#555;
  pointer-events:none;
}

/* Ensure the very last row meets the card's outside border with no white gap. */
.clone-copy-card .mini-row:last-child,
.clone-copy-card .compact-row:last-child,
.clone-copy-card .seq19-row:last-child{
  margin-bottom:0!important;
}

/* =========================================================
   V10 — READABLE ROW NUMBERS + FULL-SIZE EXPORT
   Keep 1,2,3...19 clear on screen and especially in PNG/JPG.
   ========================================================= */

/* Stronger row indexes in the original + cloned result cards. */
.seq19-v3 .seq19-index,
.clone-copy-card .seq19-v3 .seq19-index{
  font-size:15px!important;
  font-weight:900!important;
  line-height:1!important;
  letter-spacing:0!important;
}

/* Give the numbered rows a little more height so the index stays readable. */
.seq19-v3 .seq19-row,
.clone-copy-card .seq19-v3 .seq19-row{
  min-height:27px!important;
}
.seq19-v3 .seq19-index,
.seq19-v3 .seq19-value,
.clone-copy-card .seq19-v3 .seq19-index,
.clone-copy-card .seq19-v3 .seq19-value{
  min-height:27px!important;
}

/* Result values also get a small readability bump without changing formulas. */
.seq19-v3 .seq19-value,
.clone-copy-card .seq19-v3 .seq19-value{
  font-size:15px!important;
  font-weight:800!important;
}

/* IMPORTANT: preview may scale 4 copies to fit the screen, but exports should
   use the cards at their natural 1:1 size. This makes 1..19 clearly readable. */
.clone-result-canvas.clone-exporting .clone-result-copy{
  width:auto!important;
  height:auto!important;
}
.clone-result-canvas.clone-exporting .clone-copy-card{
  transform:none!important;
  transform-origin:top left!important;
}
.clone-result-canvas.clone-exporting{
  align-items:flex-start!important;
  justify-content:flex-start!important;
  gap:10px!important;
}

@media(max-width:520px){
  .seq19-v3 .seq19-index,
  .clone-copy-card .seq19-v3 .seq19-index{
    font-size:14px!important;
  }
  .seq19-v3 .seq19-value,
  .clone-copy-card .seq19-v3 .seq19-value{
    font-size:14px!important;
  }
}
