/* compras.css — Compras como SGI, gastos, cheques, tesorería, informes de caja y recalcular */

/* Encabezado del comprobante */
.cp-head { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 .8rem; }
.cp-head > * { min-width: 0; }
.cp-head .cp-sup { grid-column: 1 / -1; }
@media (min-width: 900px) { .cp-head { grid-template-columns: repeat(4, minmax(0, 1fr)); } .cp-head .cp-sup { grid-column: span 2; } }
.cp-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 .8rem; align-items: start; }
.cp-opts > * { min-width: 0; }
.cp-opts .field { grid-column: 1 / -1; }
@media (min-width: 900px) { .cp-opts { grid-template-columns: 1fr 1fr 1.4fr; } .cp-opts .field { grid-column: auto; } }

/* Renglones: tarjeta en el celu, fila en la PC */
.cp-lines { display: flex; flex-direction: column; gap: .5rem; }
.cp-line { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem .6rem; padding: .6rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); align-items: end; }
.cp-line > * { min-width: 0; }
.cp-line .cp-code { display: block; font-weight: 400; font-size: .8rem; }
.cp-line .cp-name { grid-column: 1 / -1; order: -1; font-weight: 700; overflow-wrap: anywhere; }
.cp-line input, .cp-line select { width: 100%; text-align: right; }
.cp-line .cp-f { display: flex; flex-direction: column; margin: 0; font-size: .85rem; color: var(--muted); }
.cp-line .cp-lt { align-self: center; font-size: 1.05rem; }
.cp-line .icon-btn { justify-self: end; }
.cp-lhead { display: none; }
.cp-line .r { text-align: right; }
@media (min-width: 900px) {
  .cp-line { grid-template-columns: minmax(0, 1fr) 4.6rem 6.4rem 3.9rem 3.9rem 4.8rem 6.8rem 2.6rem; gap: .3rem .4rem; padding: .3rem .5rem; align-items: center; }
  .cp-line .cp-name { grid-column: auto; order: 0; }
  .cp-line .cp-name { font-weight: 600; }
  .cp-line .cp-lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .cp-lhead { display: grid; border: 0; background: transparent; font-size: .85rem; font-weight: 700; color: var(--muted); padding-bottom: 0; }
}

/* Panel de totales */
.cp-tot { margin: 1rem 0; padding: .8rem; border: 2px solid var(--line-strong, var(--line)); border-radius: var(--radius); background: var(--surface-2); max-width: 34rem; margin-left: auto; }
.cp-trow { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .25rem 0; }
.cp-trow > label, .cp-trow > span:first-child { flex: 1 1 auto; min-width: 0; margin: 0; font-weight: 600; }
.cp-trow input { width: 10.5rem; max-width: 55%; text-align: right; }
.cp-trow .pct-input { width: 5rem; }
.cp-pair { display: flex; align-items: center; gap: .5rem; justify-content: flex-end; }
.cp-pair .money { min-width: 6.5rem; text-align: right; font-size: .95rem; }
.cp-trow.cp-inv input { font-weight: 800; font-size: 1.15rem; border-width: 2px; }
.cp-trow.cp-total { border-top: 2px solid var(--ink); margin-top: .4rem; padding-top: .5rem; font-size: 1.2rem; }
.cp-diff { margin: .2rem 0 .5rem; font-weight: 700; }
.cp-diff.ok { color: var(--brand-dark); }
.cp-diff.err { color: var(--danger); }
.cp-rets summary { cursor: pointer; font-weight: 600; padding: .3rem 0; }
.cp-tot-ro { max-width: 30rem; }

/* Listado tipo SGI: tabla en la PC, tarjetas en el celu */
.cp-table { display: none; }
.cp-table tr[data-pur] { cursor: pointer; }
.cp-table tr[data-pur]:hover { background: var(--surface-2); }
.cp-table tr.void td { color: var(--muted); text-decoration: line-through; }
@media (min-width: 900px) { .cp-table { display: block; } .cp-cards { display: none; } }

/* Tesorería, gastos, cheques */
.t-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1rem; }
@media (min-width: 900px) { .t-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.t-grid .stat .v.neg { color: var(--danger); }
.t-rows { list-style: none; margin: 0; padding: 0; }
.t-rows li { display: flex; justify-content: space-between; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.t-rows li > span:first-child { flex: 1 1 12rem; min-width: 0; }
.t-rows li .nums { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: flex-end; font-variant-numeric: tabular-nums; }
.t-rows li.t-total { font-weight: 800; border-top: 2px solid var(--ink); border-bottom: 0; }
.t-rows .neg { color: var(--danger); }
.chq-due { border-left: 4px solid var(--warn-ink, #7a4b00); }
.chq-over { border-left: 4px solid var(--danger); }
.wallet { max-height: 16rem; overflow: auto; }
.mv-media { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 .8rem; }
.mv-media > * { min-width: 0; }
.rc-table td input[type=checkbox] { width: 24px; height: 24px; }
.mv-num { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .85rem; }
.cp-table table { font-size: .86rem; }
.cp-table th, .cp-table td { padding-left: .45rem; padding-right: .45rem; }
.cp-table td:nth-child(3), .cp-table td:nth-child(4) { white-space: normal; }
.cp-table th { white-space: normal; }
