/* ProAir Purchases — piezas propias encima de proair-interfaz.css (mismos tokens). */

a.btn { text-decoration: none; display: inline-block; }
.form-error { color: var(--red); font-size: 13px; margin: 10px 0; }
.field textarea { resize: vertical; min-height: 60px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.field .hint.warn { color: var(--amber); }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.memo { white-space: pre-wrap; font-size: 13px; line-height: 1.55; }
.toolbar .spacer { flex: 1; }
tfoot td { padding: 9px 10px; font-weight: 600; border-top: 2px solid var(--line); }
tfoot tr.sub td { font-weight: 400; border-top: none; padding-top: 4px; padding-bottom: 4px; color: var(--muted); }
tfoot tr.sub:first-child td { border-top: 2px solid var(--line); padding-top: 9px; }
tfoot tr.sub + tr:not(.sub) td { border-top: 1px solid var(--line); }

/* galería de facturas */
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.inv-card {
  display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
  background: #fff; color: inherit; text-decoration: none; transition: box-shadow .15s, border-color .15s;
}
.inv-card:hover { box-shadow: var(--shadow); border-color: #bfc3c9; }
.inv-thumb { position: relative; aspect-ratio: 4 / 3; background: var(--bg); display: grid; place-items: center; overflow: hidden; }
.inv-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.inv-thumb .ph { font-size: 30px; color: #9aa0a6; text-align: center; }
.inv-thumb .ph small { display: block; font-size: 12px; margin-top: 4px; }
.inv-thumb .count {
  position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.62); color: #fff;
  font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 10px;
}
.inv-thumb .pill { position: absolute; left: 8px; top: 8px; }
.inv-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.inv-body .row { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.inv-body .vendor { font-weight: 600; color: var(--blue); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-body .amt { font-weight: 600; font-variant-numeric: tabular-nums; }
.inv-body .dim { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* visor de fotos (detalle y editor) */
.split-photo { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: 22px; align-items: start; }
.split-photo > * { min-width: 0; }
.sticky-col { position: sticky; top: 14px; }
.visor { border: 1px solid var(--line); border-radius: 6px; background: #fff; overflow: hidden; }
.visor-main { position: relative; background: #eceef1; height: min(70vh, 640px); overflow: hidden; display: grid; place-items: center; }
.visor-main img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; display: block; }
.visor-main.zoomed { overflow: auto; display: block; }
.visor-main.zoomed img { max-width: none; max-height: none; width: 220%; cursor: zoom-out; }
.visor-main iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.visor-main .ph { color: var(--muted); font-size: 13px; text-align: center; padding: 20px; line-height: 1.6; }
.visor-main .ph b { display: block; font-size: 34px; }
.visor-bar { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--muted); }
.visor-bar .spacer { flex: 1; }
.visor-thumbs { display: flex; gap: 8px; padding: 10px; overflow-x: auto; border-top: 1px solid var(--line-soft); }
.vthumb {
  position: relative; flex: 0 0 64px; height: 64px; border: 2px solid transparent; border-radius: 4px; padding: 0;
  background: var(--bg); cursor: pointer; overflow: hidden; display: grid; place-items: center; font-size: 22px; color: #9aa0a6;
}
.vthumb img { width: 100%; height: 100%; object-fit: cover; }
.vthumb.on { border-color: var(--green); }
.vthumb .tag { position: absolute; left: 2px; bottom: 2px; font-size: 9px; background: var(--amber); color: #fff; padding: 0 4px; border-radius: 3px; }

.capture { display: flex; gap: 10px; flex-wrap: wrap; padding: 12px 10px; border-top: 1px solid var(--line-soft); }
.capture label.btn { cursor: pointer; }
.capture input { display: none; }
.drop-empty {
  height: min(52vh, 420px); display: grid; place-items: center; text-align: center; color: var(--muted);
  font-size: 13px; line-height: 1.6; padding: 20px; border: 2px dashed var(--line); border-radius: 6px; margin: 10px;
}
.drop-empty b { display: block; font-size: 38px; }
.over .drop-empty, .visor.over { border-color: var(--blue); background: #f5f9fc; }

/* lectura con Claude */
.ai-bar {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; margin-bottom: 16px;
  border: 1px solid #cfe3f3; background: #f3f8fc; border-radius: 6px;
}
.ai-bar .ai-txt { flex: 1; min-width: 0; font-size: 13px; }
.ai-bar .ai-txt .dim { margin-top: 2px; }
.ai-avisos { margin: 6px 0 0; padding-left: 18px; }
.ai-avisos li { margin: 2px 0; }

/* pricebook */
.radio { display: flex; align-items: center; gap: 8px; min-height: 38px; font-size: 13px; flex-wrap: wrap; }
.cell-input.inline, .pct-input.inline { width: 110px; margin-left: auto; }
.pct-input { display: flex; align-items: center; gap: 4px; }
.pct-input input { width: 100%; padding: 8px 9px; border: 1px solid var(--line); border-radius: var(--radius); font: inherit; text-align: right; }
.pct-input span { color: var(--muted); font-size: 13px; }
tr.flash td { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: var(--green-soft); } to { background: transparent; } }

/* login con passkey */
.passkey-btn { width: 100%; padding: 11px; font-size: 15px; }
.login-o { display: flex; align-items: center; gap: 10px; margin: 16px 0 12px; color: var(--muted); font-size: 12px; }
.login-o::before, .login-o::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }

/* QuickBooks */
.qbo-txt { margin: 0 0 10px; font-size: 13px; line-height: 1.6; }
table.qbo-map td { padding: 6px 8px; }
table.qbo-map td:first-child { width: 42%; font-size: 13px; }

/* formulario */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 14px; }
.form-grid .span2 { grid-column: span 2; }

/* items editables */
.lines-wrap { overflow-x: auto; }
table.lines-edit { min-width: 560px; }
table.lines-edit td { padding: 5px 3px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.lines-edit th { padding: 8px 3px; }
.cell-input {
  width: 100%; padding: 7px 7px; border: 1px solid var(--line); border-radius: var(--radius);
  font: inherit; font-size: 13px; color: var(--ink); background: #fff;
}
.cell-input:focus { outline: 2px solid rgba(0,119,197,.35); outline-offset: -1px; border-color: var(--blue); }
.cell-input.num { text-align: right; }
.lines-edit .amt { padding-top: 13px; font-weight: 600; }
.lines-foot { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; margin-top: 12px; }
.lines-foot .spacer { flex: 1; }
.totals-box { width: 290px; max-width: 100%; }
.totals-box .kv { align-items: center; }
.totals-box .cell-input { width: 110px; }
.check-sum { font-size: 12px; margin-top: 6px; text-align: right; }

/* historial de precios en Items */
tr.hist td { background: #fafbfc; font-size: 12px; padding-top: 7px; padding-bottom: 7px; }
tr.hist td:first-child { padding-left: 26px; }
.chev { display: inline-block; width: 14px; color: var(--muted); transition: transform .15s; }
tr.open .chev { transform: rotate(90deg); }

.fab {
  position: fixed; right: 18px; bottom: 22px; width: 58px; height: 58px; border-radius: 50%;
  background: var(--green); color: #fff; font-size: 32px; line-height: 56px; text-align: center;
  text-decoration: none; box-shadow: 0 4px 14px rgba(0,0,0,.28); z-index: 20; display: none;
}
.fab:active { transform: scale(.96); }

@media (max-width: 900px) {
  .split-photo { grid-template-columns: 1fr; }
  .sticky-col { position: static; }
  .visor-main { height: 56vh; }
  .form-grid .span2 { grid-column: auto; }
  .head-actions { justify-content: flex-start; }
  .detail-head, .page-head { flex-wrap: wrap; }
  .inv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .fab:not([hidden]) { display: block; }
  .ai-bar { flex-wrap: wrap; }
}
