/* ==========================================================================
   Evidencia: pestaña del caso (.ev), adjuntos (.ev-att) y visor (.ev-lb).
   Solo tokens de base.css; sin colores fijos (modo oscuro automático).
   ========================================================================== */

/* ---------- placa de tipo (ícono por extensión) ---------- */
.ev-badge { display: inline-grid; place-items: center; width: 40px; height: 48px; border-radius: 6px 12px 6px 6px; background: var(--surface); border: 1px solid var(--hair-2); position: relative; flex: none; }
.ev-badge::before { content: ""; position: absolute; top: -1px; right: -1px; width: 12px; height: 12px; border-radius: 0 12px 0 4px; background: var(--surface-3); border-left: 1px solid var(--hair-2); border-bottom: 1px solid var(--hair-2); }
.ev-badge span { font: 700 10px/1 var(--mono); letter-spacing: .02em; color: var(--ink-2); margin-top: 10px; }
.ev-badge.lg { width: 56px; height: 68px; }
.ev-badge.lg span { font-size: 12px; margin-top: 14px; }
.ev kbd, .ev-att kbd { font: 600 11px/1 var(--mono); padding: 2px 5px; border: 1px solid var(--hair-2); border-bottom-width: 2px; border-radius: 4px; background: var(--surface); color: var(--ink-2); }

/* ---------- vista ---------- */
.ev { display: grid; gap: 14px; position: relative; }
.ev-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.ev-title { font-size: 18px; font-weight: 680; letter-spacing: -.01em; }
.ev-sum { margin: 2px 0 0; font-size: 13px; }

.ev-drop { border: 1.5px dashed var(--hair-2); border-radius: var(--r-lg); background: var(--surface); padding: 22px 18px; text-align: center; cursor: pointer; transition: border-color .15s, background-color .15s; }
.ev-drop:hover { border-color: var(--ink-3); }
.ev-drop:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ev-drop-in { display: grid; gap: 6px; justify-items: center; }
.ev-drop-in > b { font-size: 15px; font-weight: 650; }
.ev-drop-in u { color: var(--info-ink); text-underline-offset: 2px; }
.ev-drop-x { font-size: 11.5px; max-width: 760px; letter-spacing: .01em; }
.ev.drag .ev-drop { border-color: var(--accent); background: var(--accent-wash); }
.ev.drag::after { content: "Suelta para subir"; position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--accent); color: var(--accent-ink); padding: 8px 16px; border-radius: 999px; font-weight: 650; box-shadow: var(--shadow-lg); pointer-events: none; z-index: 60; }

/* ---------- subidas en curso (compartido) ---------- */
.ev-uplist, .ev-att-up { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ev-uplist:empty, .ev-att-up:empty { display: none; }
.ev-up { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r); padding: 8px 12px; font-size: 13px; }
.ev-up .progress { grid-column: 1 / -1; height: 6px; }
.ev-up .progress > i { background: var(--accent); }
.ev-up-s { color: var(--ink-2); font-size: 12px; }
.ev-up.err { border-color: color-mix(in srgb, var(--crit) 40%, var(--hair)); background: var(--crit-bg); }
.ev-up.err .ev-up-s { color: var(--crit-ink); font-weight: 600; }

/* ---------- barra de filtros ---------- */
.ev-bar { display: flex; gap: 10px 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.ev-filters { flex-wrap: wrap; }
.ev-filters button { min-height: 32px; }
.ev-tools { display: flex; gap: 8px; align-items: center; flex: 1; justify-content: flex-end; min-width: 260px; }
.ev-q { max-width: 340px; min-height: 34px; }
.ev-sort { width: auto; min-height: 34px; }

.ev-bulk { display: flex; gap: 8px 12px; align-items: center; flex-wrap: wrap; padding: 6px 10px; min-height: 44px; border-radius: var(--r); border: 1px solid transparent; }
.ev-bulk.on { background: var(--accent-wash); border-color: color-mix(in srgb, var(--accent) 30%, transparent); position: sticky; top: calc(var(--topbar-h) + 6px); z-index: 5; }
.ev-bulk .check { font-weight: 600; font-size: 13px; min-height: 32px; }
.ev-bulk-acts { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ev-bulk-link { width: auto; max-width: 280px; min-height: 30px; padding: 3px 8px; font-size: 13px; }
.ev-bulk .btn.sm { min-height: 30px; }

/* ---------- galería ---------- */
.ev-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.ev-grid:empty { display: none; }
.ev-card { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.ev-card.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ev-media { position: relative; aspect-ratio: 16 / 10; background: var(--surface-2); border-bottom: 1px solid var(--hair); }
.ev-open { all: unset; box-sizing: border-box; position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 8px; cursor: zoom-in; }
.ev-open:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; border-radius: 0; }
.ev-open img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ev-kind { font-size: 12px; }
.ev-pick { position: absolute; top: 8px; left: 8px; width: 32px; height: 32px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--hair-2); border-radius: 8px; cursor: pointer; }
.ev-pick input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.ev-vischip { position: absolute; right: 8px; bottom: 8px; box-shadow: 0 0 0 2px var(--surface); background: var(--surface); }
.ev-body { padding: 10px 12px 10px; display: grid; gap: 7px; min-width: 0; }
.ev-name { font-weight: 620; font-size: 13.5px; }
.ev-meta { font-size: 12px; margin-top: -4px; }
.ev-cap { min-height: 32px; font-size: 13px; }
.ev-link { min-height: 32px; font-size: 13px; text-overflow: ellipsis; }
.ev-link.empty { color: var(--ink-3); }
.ev-captext { margin: 0; font-size: 13px; color: var(--ink-2); }
.ev-linktext { font-size: 12.5px; color: var(--ink-2); }
.ev-acts { display: flex; align-items: center; gap: 4px; min-height: 32px; }
.ev-acts .check { font-size: 12.5px; color: var(--ink-2); min-height: 32px; white-space: nowrap; }
.ev-acts .btn.sm, .ev-att-acts .btn.sm { min-height: 30px; }
.ev-del:hover { color: var(--crit-ink); background: var(--crit-bg); }
.ev-empty .empty { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r-lg); }

/* ---------- adjuntos de un objeto ---------- */
.ev-att { display: grid; gap: 10px; border-radius: var(--r); position: relative; }
.ev-att-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ev-att-t { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); font-weight: 650; }
.ev-att-drop { border: 1.5px dashed var(--hair-2); border-radius: var(--r); padding: 10px 12px; text-align: center; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.ev-att-drop:hover { border-color: var(--ink-3); }
.ev-att.drag .ev-att-drop { border-color: var(--accent); background: var(--accent-wash); color: var(--info-ink); }
.ev-att-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ev-att-empty { font-size: 13px; padding: 2px 0; }
.ev-att-i { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; align-items: start; padding: 8px; border: 1px solid var(--hair); border-radius: var(--r); background: var(--surface); }
.ev-att-th { all: unset; box-sizing: border-box; width: 76px; height: 64px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--hair); display: grid; place-items: center; overflow: hidden; cursor: zoom-in; }
.ev-att-th:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ev-att-th img { width: 100%; height: 100%; object-fit: cover; }
.ev-att-b { display: grid; gap: 5px; min-width: 0; }
.ev-att-name { font-weight: 600; font-size: 13px; }
.ev-att-meta { font-size: 12px; margin-top: -3px; }
.ev-att-cap { font-size: 13px; color: var(--ink-2); }
.ev-att-acts { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.ev-att-acts .check { font-size: 12.5px; color: var(--ink-2); min-height: 30px; margin-right: 4px; }
.ev-att .ev-cap { min-height: 30px; padding: 4px 8px; }
/* compacto: tira de miniaturas */
.ev-att.compact .ev-att-i { grid-template-columns: 52px minmax(0, 1fr); gap: 10px; padding: 6px; }
.ev-att.compact .ev-att-th { width: 52px; height: 44px; }
.ev-att.compact .ev-badge { transform: scale(.8); }
.ev-att.compact .ev-att-drop { padding: 7px 10px; }

/* ---------- visor ---------- */
dialog.ev-lb { border: 0; padding: 0; margin: auto; width: min(1200px, calc(100vw - 24px)); height: min(900px, calc(100vh - 24px)); max-width: none; max-height: none; background: var(--surface); color: var(--ink); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); display: none; }
dialog.ev-lb[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
dialog.ev-lb { overscroll-behavior: contain; }
.ev-open:hover img, .ev-att-th:hover img { opacity: .9; }
.ev-open:hover .ev-badge, .ev-att-th:hover .ev-badge { border-color: var(--ink-3); }
dialog.ev-lb::backdrop { background: rgba(6,9,13,.78); }
.ev-lb-top { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 18px; border-bottom: 1px solid var(--hair); min-width: 0; }
.ev-lb-top h2 { font-size: 15px; font-weight: 650; flex: 1; }
.ev-lb-top .btn.icon { min-width: 34px; min-height: 34px; }
.ev-lb-stage { position: relative; display: grid; place-items: center; background: var(--surface-3); min-height: 0; overflow: hidden; }
.ev-lb-fig { margin: 0; width: 100%; height: 100%; display: grid; place-items: center; padding: 16px 64px; min-height: 0; }
.ev-lb-fig img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; box-shadow: var(--shadow); background: var(--surface); }
.ev-lb-file { display: grid; gap: 12px; justify-items: center; text-align: center; max-width: 360px; }
.ev-lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; border-radius: 10px; border: 1px solid var(--hair-2); background: var(--surface); color: var(--ink); font-size: 30px; line-height: 1; display: grid; place-items: center; box-shadow: var(--shadow); z-index: 1; }
.ev-lb-nav:hover { border-color: var(--ink-3); }
.ev-lb-nav.prev { left: 10px; } .ev-lb-nav.next { right: 10px; }
.ev-lb-foot { padding: 10px 18px 12px; border-top: 1px solid var(--hair); display: grid; gap: 4px; }
.ev-lb-cap { margin: 0; font-size: 14px; }
.ev-lb-meta { font-size: 12.5px; }
.ev-lb-hash { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12px; }
.ev-lb-hash .label { font-size: 11px; letter-spacing: .06em; color: var(--ink-3); flex: none; }
.ev-lb-hash code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; color: var(--ink-2); user-select: all; }

@media (prefers-reduced-motion: reduce) {
  .ev-drop { transition: none; }
}
@media (max-width: 760px) {
  .ev-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 10px; }
  .ev-tools { min-width: 0; flex-basis: 100%; }
  .ev-q { max-width: none; }
  .ev-drop { padding: 16px 12px; }
  .ev-drop-x { display: none; }
  .ev-lb-fig { padding: 10px; }
  .ev-lb-nav { top: auto; bottom: 10px; transform: none; width: 44px; height: 44px; }
  .ev-att-i { grid-template-columns: 56px minmax(0, 1fr); }
  .ev-att-th { width: 56px; height: 48px; }
}
@media print {
  .ev-drop, .ev-uplist, .ev-bulk, .ev-tools, .ev-pick { display: none !important; }
}
