/* ==========================================================================
   Herramientas del álbum: compartir por enlace, ordenar con un clic, importar un CSV, la lista de
   faltantes para imprimir y el acabado de los huecos (funda, toploader o imagen propia).
   ========================================================================== */

/* ---------- Compartir por enlace (share-dialog.js) ---------- */
.share-dlg .dlg-body { display: grid; gap: 14px; }
.share-intro p, .share-link p { margin: 0; }
.share-intro, .share-link { display: grid; gap: 12px; }
.share-intro > p:first-child { color: var(--text); font-size: var(--fs-lg); line-height: 1.5; }
.share-dlg .note { display: flex; align-items: flex-start; gap: 8px; color: var(--text-2); font-size: var(--fs-sm); line-height: 1.5; }
.share-dlg .note.muted { color: var(--muted); }
.share-dlg .note .i { flex: none; width: 15px; height: 15px; margin-top: 2px; color: var(--accent-2); }
.share-row { display: flex; gap: 8px; min-width: 0; }
.share-row .input { flex: 1; min-width: 0; font-family: var(--mono); font-size: var(--fs-sm); color: var(--text); }
.share-row .btn { flex: none; }
.share-loading { display: grid; justify-items: center; gap: 10px; padding: 18px 0; color: var(--muted); }
.share-loading .spinner { margin: 0; }
@media (max-width: 520px) {
  .share-row { flex-direction: column; }
  .share-dlg .dlg-foot { flex-wrap: wrap; }
}

/* ---------- Faltantes para imprimir (dialogs.js, printMissing) ----------
   En pantalla no se ve; al imprimir solo sale esto, en tinta sobre papel, en A4 y con los márgenes
   que deja «Guardar como PDF». Las filas no se parten entre páginas y la cabecera de cada tabla se
   repite. */
.print-host { display: none; }
@page { size: A4; margin: 14mm 12mm 16mm; }
@media print {

  :root { color-scheme: light; }
  html, body { height: auto !important; overflow: visible !important; background: #fff !important; }
  body.printing::before { display: none !important; }
  body.printing > :not(.print-host) { display: none !important; }
  body.printing .print-host { display: block; }
  .pm-sheet { color: #111; font-family: var(--font); font-size: 9.5pt; line-height: 1.35; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pm-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding-bottom: 8px; margin-bottom: 10px; border-bottom: 1.5pt solid #111; }
  .pm-kicker { margin: 0 0 2px; font-size: 7.5pt; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #555; }
  .pm-head h1 { margin: 0; font-family: var(--serif); font-size: 20pt; font-weight: 500; letter-spacing: -.01em; line-height: 1.1; }
  .pm-meta { margin: 4px 0 0; color: #333; }
  .pm-brand { display: grid; justify-items: end; gap: 2px; text-align: right; color: #333; }
  .pm-brand .k-mark { width: 22px; height: 22px; }
  .pm-brand .k-off { fill: #d4d4d4; }
  .pm-brand .k-on { fill: #111; }
  .pm-brand .k-hit { fill: #b08a3e; }
  .pm-brand span { font-family: var(--serif); font-size: 12pt; color: #111; }
  .pm-brand small { font-size: 7.5pt; color: #555; }
  .pm-set { margin: 0 0 10px; }
  .pm-set h2 { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 10px 0 4px; font-family: var(--serif); font-size: 12pt; font-weight: 500; break-after: avoid; page-break-after: avoid; }
  .pm-set h2 em { font-family: var(--font); font-style: normal; font-size: 8pt; color: #555; }
  .pm-set table { width: 100%; border-collapse: collapse; table-layout: fixed; }
  .pm-set thead { display: table-header-group; }
  .pm-set th { padding: 3px 4px; border-bottom: .75pt solid #111; font-size: 7pt; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #444; text-align: left; }
  .pm-set td { padding: 4px; border-bottom: .5pt solid #c9c9c9; vertical-align: top; }
  .pm-set tr { break-inside: avoid; page-break-inside: avoid; }
  .pm-box { width: 7mm; }
  .pm-box span { display: block; width: 3.6mm; height: 3.6mm; margin-top: .4mm; border: .9pt solid #111; border-radius: .6mm; }
  .pm-num { width: 29mm; padding-right: 8px !important; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
  .pm-card b { font-weight: 600; }
  .pm-card small { display: block; color: #555; font-size: 7.5pt; }
  .pm-rar { width: 14mm; }
  .pm-val { width: 20mm; text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .pm-where { width: 30mm; color: #333; }
  .pm-foot { margin-top: 12px; padding-top: 6px; border-top: .5pt solid #c9c9c9; font-size: 7.5pt; color: #666; text-align: center; }
}

/* ---------- Ordenar con un clic (sort-dialog.js) ---------- */
.sort-dlg .dlg-body { display: grid; gap: 16px; }
.sort-keys { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.sort-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.sort-opts .segmented { max-width: 100%; }
.sort-preview { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-2); min-width: 0; }
.sort-preview p { margin: 0; }
.sort-count { font-weight: 600; color: var(--text); }
.sort-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.sort-strip .ct { position: relative; aspect-ratio: 63 / 88; border-radius: var(--r-xs); overflow: hidden; background: var(--surface-3); }
.sort-strip .ct img { position: relative; display: block; width: 100%; height: 100%; object-fit: cover; }
.sort-strip .ct .fallback { font-size: 9px; padding: 2px; }
.sort-strip .ct.missing img { filter: grayscale(1) brightness(.55); }
.sort-strip .sort-more { display: grid; place-items: center; aspect-ratio: 63 / 88; border: 1px dashed var(--line-2); border-radius: var(--r-xs); color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.sort-dlg .note { margin: 0; color: var(--muted); font-size: var(--fs-xs); line-height: 1.5; }

/* ---------- Arrastrar: intercambiar o empujar (card-drag.js) ----------
   En modo «empujar», el hueco de destino lleva el acento y una raya a su izquierda: la carta entra ahí y
   las de en medio se desplazan. En el selector de páginas, el modo y la tecla para cambiarlo. */
.pocket.drop-hover.drop-push { box-shadow: 0 0 0 2px var(--accent), 0 0 calc(var(--cw) * .2) color-mix(in srgb, var(--accent) 45%, transparent); }
.pocket.drop-push::before { content: ""; position: absolute; top: 6%; bottom: 6%; left: calc(var(--gap) * -.62); width: 3px; border-radius: 2px; background: var(--accent); z-index: 6; }
.pd-modes { display: inline-flex; align-items: center; gap: 8px; margin-left: 10px; padding-left: 10px; border-left: 1px solid var(--line-2); }
.pd-mode { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); font-weight: 600; }
.pd-mode.push { color: var(--accent-2); }
.pd-mode .i { width: 13px; height: 13px; }
.pd-key { color: var(--muted); }
@media (max-width: 720px) { .pd-modes .pd-key { display: none; } }

/* En el móvil no hay ratón que lo descubra: el menú de la página se ve siempre */
@media (hover: none) { .page-menu-btn { opacity: 1; } }


/* ---------- Importar un CSV (import-dialog.js) ---------- */
.import-dlg .dlg-body { display: grid; gap: 14px; min-width: 0; }
.import-dlg p { margin: 0; }
.import-dlg .note { color: var(--muted); font-size: var(--fs-sm); line-height: 1.5; }
.import-dlg .dlg-foot { flex-wrap: wrap; }
.imp-drop { display: grid; justify-items: center; gap: 8px; padding: 28px 16px; border: 1px dashed var(--line-3); border-radius: var(--r-lg); background: var(--bg-2); text-align: center; transition: border-color var(--dur-1), background var(--dur-1); }
.imp-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.imp-drop > .i { width: 28px; height: 28px; color: var(--accent-2); }
.imp-drop b { font-family: var(--serif); font-size: var(--fs-xl); font-weight: 500; }
.imp-drop p { color: var(--text-2); }
.imp-drop .btn { margin-top: 6px; }
.imp-app { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; color: var(--text-2); }
.imp-app .i { width: 16px; height: 16px; flex: none; color: var(--accent-2); }
.imp-app > span:first-of-type { min-width: 0; overflow-wrap: anywhere; }
.imp-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); gap: 10px 12px; }
.imp-map .field, .imp-map .select { min-width: 0; width: 100%; }
.imp-found { font-weight: 600; color: var(--text); }
.imp-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; border-block: 1px solid var(--line); }
.imp-kpis li { display: grid; gap: 2px; padding: 10px 12px; border-left: 1px solid var(--line); min-width: 0; }
.imp-kpis li:first-child { border-left: 0; }
.imp-kpis b { font-family: var(--serif); font-size: var(--fs-2xl); font-weight: 450; font-variant-numeric: tabular-nums; }
.imp-kpis span { color: var(--muted); font-size: var(--fs-xs); }
.imp-review-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; }
.imp-review-head h3 { margin: 0; font-family: var(--serif); font-size: var(--fs-lg); font-weight: 500; }
.imp-review-head .link-btn { display: inline-flex; align-items: center; gap: 5px; }
.imp-review-head .i { width: 14px; height: 14px; }
.imp-review { display: grid; margin: 0; padding: 0; list-style: none; max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-lg); }
.imp-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 8px 12px; padding: 10px 12px; border-top: 1px solid var(--line-soft); }
.imp-row:first-child { border-top: 0; }
.imp-who { display: grid; gap: 2px; min-width: 0; }
.imp-who b { font-weight: 600; overflow-wrap: anywhere; }
.imp-who small { color: var(--muted); font-size: var(--fs-xs); overflow-wrap: anywhere; }
.imp-guess { display: flex; gap: 4px; color: var(--text-2) !important; }
.imp-guess .i { flex: none; width: 12px; height: 12px; margin-top: 2px; }
.imp-do { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(120px, 100%), 1fr)); gap: 6px; min-width: 0; align-self: start; }
.imp-do .input, .imp-do .select { width: 100%; min-width: 0; }
.imp-hits { grid-column: 1 / -1; display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.imp-hit { display: grid; width: 100%; padding: 6px 8px; border: 0; border-radius: var(--r-sm); background: var(--surface-2); color: var(--text); text-align: left; cursor: pointer; }
.imp-hit:hover { background: var(--surface-3); }
.imp-hit small { color: var(--muted); }
.imp-dest { display: grid; gap: 8px; }
.imp-dest .input { width: 100%; }
@media (max-width: 560px) { .imp-row { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Acabado del hueco: en Ajustes y al elegir la imagen (finish-picker.js) ---------- */
.finish-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.finish-row .segmented { max-width: 100%; }
.finish-thumb { width: 26px; height: 36px; border-radius: var(--r-xs); background: center / cover no-repeat; box-shadow: inset 0 0 0 1px var(--line-3); }
.finish-preview { justify-self: center; width: 120px; aspect-ratio: 63 / 88; border-radius: var(--r-md); border: 1px dashed var(--line-3); background: var(--bg-2) center / cover no-repeat; }
.finish-dlg .img-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.finish-dlg .img-pick .input { flex: 1 1 180px; min-width: 0; }
