/* =========================================================
   panel.css — Strobia · Dashboard de usuario y panel admin
   (usa los tokens de styles.css; cargar DESPUÉS de styles.css)
   ========================================================= */

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  height: 68px; padding: 0 clamp(1rem, 3vw, 2rem);
  background: rgba(7, 8, 12, 0.78);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.topbar .logo { gap: 0.7rem; }
.solo-celular { display: none; }                      /* texto corto de "Panel admin" */
.logo .tag-admin {
  font-family: var(--font-body); font-size: 0.66rem; font-weight: 600; letter-spacing: 0.14em;
  color: var(--accent-2); background: rgba(139, 124, 246, 0.12);
  border: 1px solid rgba(139, 124, 246, 0.4); border-radius: 999px; padding: 0.15rem 0.6rem;
}
.topbar__user { display: flex; align-items: center; gap: 0.75rem; color: var(--text-dim); font-size: 0.88rem; }

/* ---------- Layout ---------- */
.panel { padding: 2.25rem 1.25rem 4.5rem; display: flex; flex-direction: column; gap: 1.5rem; }
.page-head h1 { font-size: clamp(1.6rem, 3.5vw, 2.1rem); font-weight: 600; }
.page-head p { color: var(--text-dim); margin-top: 0.25rem; }

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.section-head { margin-bottom: 1.25rem; }
.section-head h2 { font-size: 1.2rem; font-weight: 600; }
.section-head p:not(.leyenda-reventa) { color: var(--text-dim); font-size: 0.88rem; margin-top: 0.15rem; }
.hint { color: var(--text-faint); font-size: 0.8rem; margin-top: 0.9rem; }
.empty { color: var(--text-dim); }

/* ---------- Botones del panel ---------- */
.btn--sm { padding: 0.45rem 0.9rem; font-size: 0.8rem; border-radius: 6px; }
.btn--xs { padding: 0.3rem 0.65rem; font-size: 0.72rem; border-radius: 6px; }

.btn--success { background: #15803d; border-color: #15803d; color: #fff; }
.btn--success:hover { background: #166534; border-color: #166534; }

.btn--danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn--danger:hover { background: #b91c1c; border-color: #b91c1c; }

/* WhatsApp: verde de marca + ícono de chat (CSS, sin imágenes) */
.btn--whatsapp { background: #25d366; border-color: #25d366; color: #05260f; }
.btn--whatsapp:hover { background: #1fbd5a; border-color: #1fbd5a; box-shadow: 0 6px 16px -8px rgba(37, 211, 102, 0.7); }
.btn--whatsapp::before {
  content: ""; width: 16px; height: 16px; flex-shrink: 0; background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------- Mensajes ---------- */
.msg {
  padding: 0.75rem 1rem; border-radius: var(--radius-sm); font-size: 0.9rem;
  color: #a9c1ff; background: var(--accent-soft); border: 1px solid rgba(91, 140, 255, 0.28);
}
.msg:empty { display: none; }
.msg--error { color: #fca5a5; background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.3); }
.filters + .msg { margin-top: 1rem; }

/* ---------- Catálogo ---------- */
.grid-tickets { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.grid-tickets .empty { grid-column: 1 / -1; text-align: center; padding: 2rem 1rem; }

.ticket-card {
  display: flex; flex-direction: column; gap: 0.9rem;
  padding: 1.25rem;
  background: #0f1218;
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.ticket-card:hover { transform: translateY(-2px); border-color: rgba(37, 99, 235, 0.6); box-shadow: 0 14px 30px -18px rgba(0, 0, 0, 0.9); }

.ticket-card__head { display: flex; align-items: flex-start; gap: 0.85rem; }
.ticket-card__title { min-width: 0; }
.ticket-card__title h3 { font-size: 1.02rem; font-weight: 600; line-height: 1.3; }
.ticket-card__dj { display: flex; align-items: flex-start; gap: 0.4rem; margin-top: 0.3rem; font-size: 0.85rem; font-weight: 500; color: #a9c1ff; }

/* Fecha en "tile" */
.date-tile {
  flex-shrink: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 52px; padding: 0.45rem 0; line-height: 1;
  background: rgba(37, 99, 235, 0.12); border: 1px solid rgba(37, 99, 235, 0.35); border-radius: 8px;
}
.date-tile__day { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; color: #fff; }
.date-tile__mon { margin-top: 0.25rem; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.1em; color: #8fb0ff; }

/* Fecha larga y lugar */
.ticket-card__meta { display: flex; flex-direction: column; gap: 0.4rem; padding-top: 0.8rem; border-top: 1px solid var(--border); }
.ticket-card__meta li { display: flex; align-items: flex-start; gap: 0.5rem; font-size: 0.84rem; color: var(--text-dim); }
.ticket-card__meta .ico { margin-top: 0.12rem; color: var(--text-faint); }

.ticket-card__pricing { margin-top: auto; padding-top: 0.9rem; border-top: 1px dashed var(--border-strong); }
.ticket-card__price { font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; letter-spacing: -0.02em; }
.ticket-card__breakdown { margin-top: 0.2rem; color: var(--text-faint); font-size: 0.78rem; line-height: 1.4; }

.tag-own {
  text-align: center; padding: 0.45rem 0.8rem; border: 1px dashed var(--border-strong);
  border-radius: 8px; color: var(--text-faint); font-size: 0.8rem;
}

/* ---------- Íconos chicos (máscaras SVG, toman el color del texto) ---------- */
.ico {
  display: inline-block; width: 15px; height: 15px; flex-shrink: 0; background-color: currentColor;
  -webkit-mask: var(--ico) center / contain no-repeat;
  mask: var(--ico) center / contain no-repeat;
}
.ico--calendar { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 18H4V8h16v13z'/%3E%3C/svg%3E"); }
.ico--pin { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5a2.5 2.5 0 0 1 0-5 2.5 2.5 0 0 1 0 5z'/%3E%3C/svg%3E"); }
.ico--music { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z'/%3E%3C/svg%3E"); }

/* ---------- Formulario de venta ---------- */
.form-venta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; align-items: start; margin-bottom: 0.25rem; }
.form-venta .field--full { grid-column: 1 / -1; }
.form-venta .field input { height: 50px; }
.form-venta__actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.form-venta__actions .btn { height: 48px; }
.form-venta + .form__error { margin: 0.5rem 0 1rem; }

@media (max-width: 720px) {
  .form-venta { grid-template-columns: 1fr; }
  .form-venta__actions .btn { width: 100%; }
}

/* ---------- Formulario de venta ---------- */
.form-inline { display: grid; grid-template-columns: 2fr 1fr auto; gap: 0.85rem; align-items: end; margin-bottom: 0.25rem; }
.form-inline .field input { height: 50px; }
.form-inline .btn { height: 50px; }
.form-inline + .form__error { margin: 0.5rem 0 1rem; }

/* ---------- Stats (admin) ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.stat {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.3rem;
  box-shadow: var(--shadow-card);
}
.stat__label { color: var(--text-faint); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; }
.stat__value { font-family: var(--font-display); font-size: 1.9rem; font-weight: 600; letter-spacing: -0.02em; margin-top: 0.2rem; }
.stat--alert { border-color: rgba(139, 124, 246, 0.35); }
.stat--alert .stat__value {
  background: linear-gradient(120deg, #9bb8ff, #b0a4fb);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- Filtros (admin) ---------- */
.filters { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.25rem; }
.filters__btn {
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); color: var(--text-dim);
  padding: 0.5rem 1rem; border-radius: 999px; font: 600 0.82rem var(--font-body); cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.25s;
}
.filters__btn:hover { color: var(--text); border-color: var(--border-strong); }
.filters__btn.is-active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: none; }

/* ---------- Tablas ---------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;                 /* en celular la tabla se desplaza horizontalmente */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.table { width: 100%; min-width: 680px; border-collapse: collapse; font-size: 0.9rem; }
.table--wide { min-width: 1120px; } /* tabla del admin (9 columnas) */
.table td { padding: 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color 0.2s; }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
.table tr.row--dispute { background: rgba(139, 124, 246, 0.07); }
.table tr.row--dispute td:first-child { box-shadow: inset 3px 0 0 var(--accent-2); }
.table td.empty { text-align: center; color: var(--text-faint); padding: 2.2rem 1rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem; color: var(--text-faint); }
.actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* ---------- Badges de estado ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.22rem 0.7rem; border-radius: 999px;
  font-size: 0.74rem; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap;
  color: var(--text-dim); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--disponible { color: #8fb0ff; background: rgba(91, 140, 255, 0.12); border-color: rgba(91, 140, 255, 0.28); }
.badge--pendiente_pago { color: var(--text-dim); background: rgba(255, 255, 255, 0.05); border-color: var(--border); }
.badge--pago_retenido { color: #b4a9ff; background: rgba(139, 124, 246, 0.14); border-color: rgba(139, 124, 246, 0.32); }
.badge--completado { color: var(--success); background: rgba(52, 211, 153, 0.1); border-color: rgba(52, 211, 153, 0.28); }
.badge--reembolso_pendiente, .badge--revisar_manual { color: var(--warning); background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.28); }

/* ---------- Indicador de recepción (validación de entrega) ---------- */
.confirm-tag { display: inline-flex; align-items: center; gap: 0.35rem; margin-top: 0.45rem; font-size: 0.74rem; color: var(--text-faint); }
.confirm-tag--ok {
  padding: 0.22rem 0.65rem; border-radius: 999px; font-weight: 600;
  color: var(--success); background: rgba(52, 211, 153, 0.1); border: 1px solid rgba(52, 211, 153, 0.28);
}
.table td > .confirm-tag:only-child { margin-top: 0; }

/* ---------- Modal ---------- */
.modal {
  margin: auto; width: min(420px, calc(100% - 2rem)); padding: 1.75rem;
  color: var(--text); background: rgba(17, 20, 28, 0.94);
  border: 1px solid var(--border-strong); border-radius: 18px;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.95), var(--glow);
}
.modal[open] { animation: modal-in 0.22s var(--ease); }
.modal::backdrop { background: rgba(4, 5, 8, 0.72); backdrop-filter: blur(6px); }
.modal h3 { font-size: 1.2rem; font-weight: 600; margin-bottom: 0.5rem; }
.modal p { color: var(--text-dim); margin-bottom: 1.4rem; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 900px) { .stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) {
  .topbar { padding: 0 0.85rem; }
  .panel { padding: 1.25rem 0.75rem 3rem; gap: 1.1rem; }
  .card { padding: 1rem; border-radius: 14px; }
  .section-head { margin-bottom: 1rem; }

  .form-inline { grid-template-columns: 1fr; }
  .form-inline .btn { width: 100%; }
  .grid-tickets { grid-template-columns: 1fr; }

  .stats { gap: 0.75rem; }
  .stat { padding: 0.9rem 1rem; }
  .stat__value { font-size: 1.5rem; }

  .table { font-size: 0.85rem; }
  .table th, .table td { padding: 0.65rem 0.75rem; }
}
@media (max-width: 480px) { .stats { grid-template-columns: 1fr; } }
/* ---------- Doble confirmación ---------- */
.confirm-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 0.4rem; }
.confirm-stack .confirm-tag { margin-top: 0; }
.confirm-tag--no {
  padding: 0.22rem 0.65rem; border-radius: 999px;
  color: var(--text-faint); background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border);
}
.buyer-email { font-size: 0.85rem; font-weight: 600; color: var(--text); word-break: break-all; user-select: all; }

/* Fila lista para liberar (ambos confirmaron) */
.table tr.row--ready { background: rgba(52, 211, 153, 0.07); }
.table tr.row--ready td:first-child { box-shadow: inset 3px 0 0 var(--success); }

/* Botón "Liberar Escrow": opacado hasta que ambos confirman, luego destaca */
.btn--success:disabled { filter: grayscale(0.7); box-shadow: none; }
.btn--ready {
  box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.6), 0 10px 34px -8px rgba(52, 211, 153, 0.8);
  animation: pulse-ready 2.2s ease-in-out infinite;
}
@keyframes pulse-ready {
  0%, 100% { box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.6), 0 10px 34px -8px rgba(52, 211, 153, 0.8); }
  50% { box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.25), 0 10px 40px -6px rgba(52, 211, 153, 1); }
}
/* ---------- Liberación forzada (admin) ---------- */
.btn--xs { padding: 0.3rem 0.65rem; font-size: 0.72rem; border-radius: 7px; }
.btn--force { background: transparent; color: var(--warning); border-color: rgba(251, 191, 36, 0.4); }
.btn--force:hover { background: rgba(251, 191, 36, 0.12); border-color: var(--warning); }
.actions--stack { flex-direction: column; align-items: flex-start; }
.confirm-tag--warn { color: var(--warning); }
.badge--pausada { color: var(--warning); background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.28); }
/* =========================================================
   ETAPA 5 — AGREGAR AL FINAL DE public/css/panel.css
   Banner de verificación, formularios (select / archivo / textarea),
   modales nuevos, perfil, estrellas, comprobante y panel admin
   (pestañas + cartelera). Mobile-first, Dark Mode.
   (Los estilos compartidos —cartelera, badges de modalidad,
   avatares, reputación— van en styles.css: ver styles.append.css)
   ========================================================= */

/* ---------- Tablas: encabezados ---------- */
.table th {
  padding: 0.85rem 1rem; text-align: left; white-space: nowrap;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--text-faint); background: rgba(255, 255, 255, 0.02); border-bottom: 1px solid var(--border);
}
.table tr.row--past { opacity: 0.6; }
.tx-modo { display: flex; flex-direction: column; align-items: flex-start; gap: 0.3rem; margin-top: 0.4rem; }

/* ---------- Campos: select, archivo, textarea ---------- */
.field select,
.field textarea {
  width: 100%; color-scheme: dark;
  background: rgba(0, 0, 0, 0.35); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font: 400 0.98rem var(--font-body);
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}
.field select { height: 50px; padding: 0 0.95rem; }
.field textarea { padding: 0.8rem 0.95rem; resize: vertical; min-height: 110px; line-height: 1.5; }
.field textarea::placeholder { color: var(--text-faint); }
.field select:hover, .field textarea:hover { border-color: var(--border-strong); }
.field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: rgba(0, 0, 0, 0.5); }
.field select option { background: #11141c; color: var(--text); }

.field input[type="file"],
.form-venta .field input[type="file"] { height: auto; padding: 0.6rem 0.75rem; color: var(--text-dim); font-size: 0.88rem; }
.field input[type="file"]::file-selector-button {
  margin-right: 0.8rem; padding: 0.4rem 0.8rem; cursor: pointer;
  color: var(--text); background: rgba(255, 255, 255, 0.07); border: 1px solid var(--border-strong); border-radius: 6px;
  font: 600 0.8rem var(--font-body);
}
.field input[type="file"]::file-selector-button:hover { background: rgba(255, 255, 255, 0.12); }
input[type="datetime-local"] { color-scheme: dark; }

/* Formulario de venta: bloque manual ("Otro evento") */
.venta-manual { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr; gap: 0.9rem; align-items: start; }
.venta-bloqueo { margin: 0.25rem 0 0.75rem; color: var(--warning); }
.form-venta__actions { gap: 0.6rem; flex-wrap: wrap; }

/* ---------- Banner de verificación de email ---------- */
.banner-verif {
  display: flex; flex-direction: column; gap: 0.8rem; padding: 1.1rem 1.25rem; border-radius: var(--radius);
  color: #fde68a; background: linear-gradient(180deg, rgba(251, 191, 36, 0.14), rgba(251, 191, 36, 0.06));
  border: 1px solid rgba(251, 191, 36, 0.45); box-shadow: 0 10px 30px -18px rgba(251, 191, 36, 0.5);
}
.banner-verif h2 { font-size: 1.05rem; font-weight: 600; color: #fef3c7; }
.banner-verif p { color: #fde68a; font-size: 0.9rem; }
.banner-verif__actions { display: flex; flex-direction: column; gap: 0.6rem; }
.banner-verif__actions .btn { width: 100%; }
.banner-verif__msg { font-size: 0.86rem; font-weight: 600; min-height: 1.2em; }

/* ---------- Avatares: tamaños + botón "Mi perfil" ---------- */
.avatar--sm { width: 28px; height: 28px; font-size: 0.68rem; }
.avatar--lg { width: 104px; height: 104px; font-size: 1.9rem; }
#btn-perfil { display: inline-flex; align-items: center; gap: 0.5rem; padding-left: 0.4rem; }

/* ---------- Modales ---------- */
.modal--wide { width: min(480px, calc(100% - 2rem)); }
.modal--img { width: min(720px, calc(100% - 2rem)); }
.modal { max-height: calc(100dvh - 2rem); overflow-y: auto; }
.modal .modal__lead { margin-bottom: 1rem; }
.modal .field { margin-bottom: 0.9rem; }
.modal .form__error { margin: 0.4rem 0 0; }
.modal .modal__ok { color: var(--success); font-size: 0.88rem; font-weight: 600; margin: 0.4rem 0 0; min-height: 1.2em; }

/* Botones de los modales: apilados en celular, en fila desde 561px */
.modal__actions { display: flex; flex-direction: column-reverse; gap: 0.6rem; margin-top: 1.2rem; }
.modal__actions .btn { width: 100%; }
.modal__actions .btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Consentimiento obligatorio (liberación rápida) */
.modal .consent-check {
  display: flex; align-items: flex-start; gap: 0.7rem; margin: 0 0 0.5rem; padding: 0.9rem 1rem; cursor: pointer;
  color: var(--text); font-size: 0.92rem; line-height: 1.45;
  background: rgba(251, 191, 36, 0.08); border: 1px solid rgba(251, 191, 36, 0.3); border-radius: 10px;
}
.modal .consent-check input { margin-top: 0.2rem; width: 18px; height: 18px; flex-shrink: 0; accent-color: #f59e0b; }

/* Mi perfil */
.perfil-head { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; margin-bottom: 1.2rem; text-align: center; }
.perfil-head__user { font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; }
.perfil-head__rating { font-size: 0.92rem; font-weight: 600; color: #fbbf24; }
.perfil-head__rating--none { color: var(--text-faint); font-weight: 500; }

/* Comprobante (vista previa del vendedor y vista del admin) */
.comprobante-preview {
  display: block; max-width: 100%; max-height: 260px; margin: 0.4rem auto 0;
  border-radius: 10px; border: 1px solid var(--border-strong); object-fit: contain; background: #000;
}
.comprobante-view {
  display: block; width: 100%; max-height: 65dvh; border-radius: 10px;
  border: 1px solid var(--border-strong); object-fit: contain; background: #000;
}

/* Calificación 1 a 5 estrellas */
.stars { display: flex; justify-content: center; gap: 0.3rem; margin: 0.4rem 0 0.6rem; }
.star {
  background: none; border: 0; padding: 0.1rem 0.2rem; cursor: pointer;
  font-size: 2.3rem; line-height: 1; color: rgba(255, 255, 255, 0.2); transition: color 0.15s, transform 0.15s;
}
.star:hover { transform: scale(1.12); }
.star.is-on { color: #fbbf24; }
/* Estrellas (js/iconos.js): solo contorno; las elegidas, rellenas */
.star .icono { display: block; width: 1em; height: 1em; margin: 0; }
.star.is-on .icono { fill: currentColor; }
.timeline__marker .icono { width: 0.85rem; height: 0.85rem; margin: 0; stroke-width: 3; }

/* ---------- Panel admin: pestañas + cartelera ---------- */
.admin-tabs { display: flex; flex-direction: column; gap: 4px; padding: 4px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--border); border-radius: 12px; }
.admin-tabs__btn {
  background: transparent; border: 0; color: var(--text-dim); padding: 0.7rem 1rem; border-radius: 9px;
  font: 600 0.92rem var(--font-body); cursor: pointer; text-align: center;
  transition: background-color 0.2s, color 0.2s, box-shadow 0.25s;
}
.admin-tabs__btn:hover { color: var(--text); }
.admin-tabs__btn.is-active { background: var(--surface-2); color: #fff; box-shadow: 0 0 0 1px var(--border-strong), 0 6px 18px -8px rgba(91, 140, 255, 0.5); }
.admin-panel { display: flex; flex-direction: column; gap: 1.5rem; }

.flyer-preview { display: block; width: min(100%, 220px); aspect-ratio: 4 / 5; margin-top: 0.6rem; object-fit: cover; border-radius: 12px; border: 1px solid var(--border-strong); background: #0f1218; }
.evento-thumb { display: block; width: 44px; height: 55px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border-strong); background: #0f1218; }

/* ---------- Escritorio ---------- */
@media (min-width: 561px) {
  .banner-verif__actions { flex-direction: row; flex-wrap: wrap; }
  .banner-verif__actions .btn { width: auto; }

  .modal__actions { flex-direction: row; flex-wrap: wrap; justify-content: flex-end; }
  .modal__actions .btn { width: auto; }

  .admin-tabs { flex-direction: row; flex-wrap: wrap; width: fit-content; max-width: 100%; }
  .admin-tabs__btn { white-space: nowrap; }
}
@media (min-width: 721px) {
  .venta-manual { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Filtro "Listas para liberar" (contador) ---------- */
.filters__count {
  display: inline-block; min-width: 1.4em; margin-left: 0.3rem; padding: 0 0.4em; border-radius: 999px;
  background: rgba(255, 255, 255, 0.12); font-size: 0.75rem; line-height: 1.5; text-align: center;
}
.filters__btn--listas:not(.is-active) .filters__count--hay { background: rgba(52, 211, 153, 0.18); color: var(--success); }
.filters__btn.is-active .filters__count { background: rgba(0, 0, 0, 0.25); }

/* ---------- Pestaña Usuarios ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.user-tools { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.user-search {
  flex: 1 1 280px; height: 46px; padding: 0 0.95rem; color: var(--text); font: inherit;
  background: rgba(0, 0, 0, 0.4); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.user-search::placeholder { color: var(--text-faint); }
.user-search:hover { border-color: var(--border-strong); }
.user-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.user-count { margin: 0; }
.table--users { min-width: 1080px; }
.badge--ok { color: var(--success); background: rgba(52, 211, 153, 0.1); border-color: rgba(52, 211, 153, 0.28); }
.badge--off { color: var(--text-dim); background: rgba(255, 255, 255, 0.05); border-color: var(--border); }
.badge--bad { color: #fca5a5; background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.3); }
.table tr.row--suspendido td:first-child { box-shadow: inset 3px 0 0 #f87171; }


/* =========================================================
   MOBILE-FIRST (panel): topbar, modales, tablas
   ========================================================= */
@media (max-width: 768px) {
  .topbar { height: 60px; gap: 0.5rem; padding: 0 0.85rem; }
  .topbar .logo { gap: 0.5rem; }
  .topbar__user { gap: 0.45rem; flex-shrink: 0; }
  .topbar__user .btn { font-size: 0.78rem; padding: 0.45rem 0.85rem; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
}
@media (max-width: 560px) {
  #user-name, #admin-email { display: none; }          /* textos secundarios largos */
  .solo-ancho { display: none; }
  .solo-celular { display: inline; }
}
@media (max-width: 480px) {
  .logo .tag-admin { display: none; }
}
@media (max-width: 400px) {
  /* queda el avatar (sin el texto "Mi perfil") y botones compactos */
  #btn-perfil > span:not(.avatar) { display: none; }
  #btn-perfil { padding: 0.3rem 0.45rem; }
  .topbar__user .btn { padding: 0.45rem 0.7rem; }
}

/* Modales (<dialog>) en celular */
@media (max-width: 560px) {
  .modal, .modal.modal--wide, .modal.modal--img { width: calc(100vw - 1.5rem); max-width: none; padding: 1.25rem; max-height: calc(100dvh - 1.5rem); }
  .modal .modal__actions { flex-direction: column-reverse; align-items: stretch; gap: 0.6rem; }
  .modal .modal__actions .btn { width: 100%; min-height: 44px; }
  .medios-pago__grid { gap: 0.4rem; }
  .medio-pago { height: 44px; padding: 0 0.4rem; }
  .medio-pago img { height: 20px; }
  .medio-pago img[src*="mastercard"], .medio-pago img[src*="amex"] { height: 26px; }
  .resumen-pago > div { padding: 0.6rem 0.85rem; }
}


/* =========================================================
   ESCROW: disputas, reembolsos y cuenta regresiva
   ========================================================= */
.badge--en_disputa { color: #fca5a5; background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.3); }
.badge--reembolsado { color: #8fb0ff; background: rgba(91, 140, 255, 0.12); border-color: rgba(91, 140, 255, 0.28); }

/* Cuenta regresiva del plazo de entrega */
.cuenta {
  display: inline-flex; align-items: center; padding: 0.22rem 0.65rem; border-radius: 999px;
  font-size: 0.78rem; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--warning); background: rgba(251, 191, 36, 0.1); border: 1px solid rgba(251, 191, 36, 0.3);
}
.cuenta--vencida { color: #fca5a5; background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.3); }
.confirm-stack .confirm-tag { max-width: 34ch; line-height: 1.4; }

/* Banner de reclamos abiertos */
.banner-disputa {
  display: flex; flex-direction: column; gap: 0.8rem; padding: 1.1rem 1.25rem; border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(248, 113, 113, 0.14), rgba(248, 113, 113, 0.05));
  border: 1px solid rgba(248, 113, 113, 0.4);
}
.banner-disputa[hidden] { display: none; }
.banner-disputa h2 { font-size: 1.05rem; font-weight: 600; color: #fecaca; }
.banner-disputa__item { display: flex; flex-direction: column; gap: 0.6rem; align-items: stretch; }
.banner-disputa__item p { margin: 0; color: #fecaca; font-size: 0.9rem; line-height: 1.45; }
.banner-disputa__item .btn { width: 100%; }
@media (min-width: 561px) {
  .banner-disputa__item { flex-direction: row; align-items: center; justify-content: space-between; gap: 1rem; }
  .banner-disputa__item .btn { width: auto; flex-shrink: 0; }
}

/* Hilo de mensajes */
.modal--hilo { width: min(580px, calc(100% - 2rem)); }
.hilo {
  display: flex; flex-direction: column; gap: 0.6rem; max-height: min(46dvh, 380px); overflow-y: auto;
  margin-bottom: 1rem; padding: 0.7rem; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border); border-radius: 12px;
}
.hilo .empty { margin: 0; text-align: center; font-size: 0.88rem; }
.hilo__msg {
  align-self: flex-start; max-width: 88%; padding: 0.6rem 0.8rem; border-radius: 12px 12px 12px 4px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border);
}
.hilo__msg--mio { align-self: flex-end; border-radius: 12px 12px 4px 12px; background: rgba(37, 99, 235, 0.18); border-color: rgba(91, 140, 255, 0.35); }
.hilo__msg--admin { background: rgba(139, 124, 246, 0.16); border-color: rgba(139, 124, 246, 0.4); }
.hilo__meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.2rem 0.8rem; font-size: 0.72rem; color: var(--text-faint); }
.hilo__meta strong { color: var(--text); font-weight: 600; }
.modal .hilo__texto { margin: 0.3rem 0 0; color: var(--text); font-size: 0.9rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.hilo__evidencia { display: block; margin-top: 0.5rem; }
.hilo__evidencia img { display: block; max-width: 100%; max-height: 200px; border-radius: 8px; border: 1px solid var(--border-strong); background: #000; object-fit: contain; }

/* ---------- Admin: contadores de pestañas, semáforo de pago y tarjetas de disputa/reembolso ---------- */
.tab-count {
  display: inline-block; min-width: 1.5em; margin-left: 0.35rem; padding: 0 0.45em; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; line-height: 1.6; text-align: center; color: #fff; background: #dc2626;
}
.tab-count[hidden] { display: none; }
.tab-count--warn { color: #1f1500; background: var(--warning); }

.pago-badge { display: inline-flex; align-items: center; padding: 0.22rem 0.65rem; border-radius: 999px; font-size: 0.74rem; font-weight: 700; white-space: nowrap; }
.pago-badge--ok { color: var(--success); background: rgba(52, 211, 153, 0.1); border: 1px solid rgba(52, 211, 153, 0.3); }
.pago-badge--pronto { color: var(--warning); background: rgba(251, 191, 36, 0.12); border: 1px solid rgba(251, 191, 36, 0.35); }
.pago-badge--vencido { color: #fca5a5; background: rgba(248, 113, 113, 0.12); border: 1px solid rgba(248, 113, 113, 0.38); }

.disputa-lista { display: flex; flex-direction: column; gap: 1rem; }
.disputa-card {
  display: flex; flex-direction: column; gap: 0.8rem; padding: 1.1rem 1.2rem;
  background: #0f1218; border: 1px solid var(--border); border-radius: 12px;
}
.disputa-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.8rem; }
.disputa-card__motivo { margin: 0; font-size: 0.9rem; color: var(--text); }
.disputa-card__desc { margin: 0; font-size: 0.9rem; line-height: 1.5; color: var(--text-dim); white-space: pre-wrap; overflow-wrap: anywhere; }
.disputa-partes { display: grid; grid-template-columns: 1fr; gap: 0.7rem; }
.disputa-parte { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.7rem 0.85rem; font-size: 0.86rem; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border); border-radius: 10px; overflow-wrap: anywhere; }
.disputa-card__entrega { display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem; }
.disputa-card__acciones { display: flex; flex-direction: column; gap: 0.5rem; }
.disputa-card__acciones .btn { width: 100%; }
.reembolso-pago { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.8rem; padding: 0.8rem 1rem; background: rgba(251, 191, 36, 0.08); border: 1px solid rgba(251, 191, 36, 0.35); border-radius: 10px; }
.reembolso-pago__label { flex-basis: 100%; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--warning); }
.reembolso-pago__id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.25rem; letter-spacing: 0.02em; user-select: all; word-break: break-all; }
.reembolso-monto { margin: 0; font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; }
@media (min-width: 721px) {
  .disputa-partes { grid-template-columns: 1fr 1fr; }
  .disputa-card__acciones { flex-direction: row; flex-wrap: wrap; }
  .disputa-card__acciones .btn { width: auto; }
}

/* El carrusel del panel (#panel-cartelera-grid + .carousel-track) se define en styles.css */

/* Flyers del panel: siempre completos (sin recorte) y badges superpuestos */
.pe-card__media { display: flex; align-items: center; justify-content: center; width: 100%; background: #080a0f; overflow: hidden; }
.pe-card__media img { width: 100%; height: auto; max-height: 340px; object-fit: contain; display: block; }
.pe-card__ph { width: 100%; }
.pe-card__date, .pe-card__cat { position: absolute; z-index: 1; }
.pe-card__cat {
  top: 0.6rem; right: 0.6rem; max-width: 55%; padding: 0.3rem 0.55rem; border-radius: 999px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.62rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; line-height: 1;
  color: #c4bcff; background: rgba(7, 8, 12, 0.85); border: 1px solid rgba(139, 124, 246, 0.4);
}
@media (max-width: 600px) {
  .panel { padding-bottom: 5.5rem; }   /* el botón flotante de soporte no tapa lo último */
}

/* =========================================================
   TIMELINE DE ESTADOS (Mis compras / Mis ventas)
   Lista ordenada. El estado se comunica con símbolo + palabra ("En curso", "Pendiente", fecha…), no solo con color.
   ========================================================= */
.celda-timeline { display: flex; flex-direction: column; align-items: flex-start; gap: 0.6rem; min-width: 15rem; }
.celda-timeline > .confirm-stack { width: 100%; }

.timeline { list-style: none; margin: 0; padding: 0; width: 100%; max-width: 30rem; }
.timeline__item {
  position: relative; display: grid; grid-template-columns: 1.5rem minmax(0, 1fr); column-gap: 0.65rem;
  padding-bottom: 0.9rem;
}
.timeline__item:last-child { padding-bottom: 0; }
/* Conector vertical entre pasos */
.timeline__item::before {
  content: ""; position: absolute; left: calc(0.75rem - 1px); top: 1.5rem; bottom: 0; width: 2px;
  background: var(--border-strong);
}
.timeline__item:last-child::before { display: none; }
.timeline__item--hecho::before { background: rgba(52, 211, 153, 0.55); }

.timeline__marker {
  display: grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; box-sizing: border-box;
  font-size: 0.72rem; font-weight: 800; line-height: 1; color: var(--text-faint);
  background: var(--bg, #050608); border: 2px dashed var(--border-strong);
}
.timeline__item--hecho .timeline__marker { color: var(--success); background: rgba(52, 211, 153, 0.14); border: 2px solid var(--success); }
.timeline__item--actual .timeline__marker { color: var(--accent); background: var(--accent-soft); border: 2px solid var(--accent); }
.timeline__item--alerta .timeline__marker { color: #fca5a5; background: rgba(248, 113, 113, 0.14); border: 2px solid #f87171; }
.timeline__item--reembolso .timeline__marker { color: var(--warning); background: rgba(251, 191, 36, 0.12); border: 2px solid var(--warning); }

.timeline__body { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.timeline__label { font-size: 0.84rem; font-weight: 600; line-height: 1.3; color: var(--text); overflow-wrap: anywhere; }
.timeline__item--pendiente .timeline__label { color: var(--text-dim); font-weight: 500; }
.timeline__item--actual .timeline__label { color: #fff; }
.timeline__item--alerta .timeline__label { color: #fca5a5; }
.timeline__item--reembolso .timeline__label { color: var(--warning); }
.timeline__fecha { font-size: 0.74rem; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.timeline__ayuda { display: flex; flex-direction: column; align-items: flex-start; gap: 0.3rem; margin-top: 0.3rem; }
.timeline__ayuda p { margin: 0; font-size: 0.76rem; line-height: 1.45; color: var(--text-dim); max-width: 34ch; }
.timeline__ayuda .cuenta { margin-top: 0.1rem; }

@media (prefers-reduced-motion: no-preference) {
  .timeline__item--actual .timeline__marker { animation: timeline-pulso 2.4s ease-in-out infinite; }
}
@keyframes timeline-pulso {
  0%, 100% { box-shadow: 0 0 0 0 rgba(91, 140, 255, 0.45); }
  50% { box-shadow: 0 0 0 5px rgba(91, 140, 255, 0); }
}

/* =========================================================
   MÉTRICAS (admin) — barras con CSS, sin librerías
   ========================================================= */
.metricas { display: flex; flex-direction: column; gap: 1.5rem; margin-top: 1rem; }
.metricas__stats { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stat__value--metrica { font-size: 1.45rem; overflow-wrap: anywhere; }
.metrica__detalle { margin-top: 0.35rem; font-size: 0.76rem; line-height: 1.4; color: var(--text-dim); }
.metricas__bloque { display: flex; flex-direction: column; gap: 0.7rem; }
.metricas__titulo { font-size: 1rem; font-weight: 600; }
.barra { width: 100%; min-width: 80px; height: 8px; border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, 0.07); }
.barra__fill { height: 100%; min-width: 2px; border-radius: 999px; background: var(--grad); }
.metricas-barra { display: grid; grid-template-columns: 1fr; gap: 0.25rem 0.8rem; align-items: center; }
.metricas-barra__label { font-size: 0.84rem; color: var(--text-dim); }
.metricas-barra__valor { font-size: 0.9rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.metricas-barra--custodia .barra__fill { background: var(--warning); }
.metricas-barra--reembolso .barra__fill { background: #f87171; }
.metricas-barra--volumen .barra__fill { background: var(--success); }
@media (min-width: 721px) {
  .metricas-barra { grid-template-columns: 11rem 1fr 9rem; }
  .metricas-barra__valor { text-align: right; }
}

/* =========================================================
   MIS COMPRAS / MIS VENTAS en celular: cada fila de la tabla pasa a ser una TARJETA de una columna.
   Solo móvil (max-width: 640px): el escritorio no cambia. No usa clases de JS: parte de la estructura que ya arma
   renderTabla() (tr > td[data-label]).
   Orden vertical:  Entrada · Precio / Total · Estado · ENTREGA · fecha · Acciones.
   Patrón uniforme: cada dato es una fila "ETIQUETA (arriba, chica) / valor (abajo)". La Entrada hace de título (sin etiqueta).
   Las celdas sin contenido útil ("—", p. ej. ENTREGA en una entrada disponible) llevan .celda-vacia y no se muestran.
   ========================================================= */
@media (max-width: 640px) {
  #sec-compras .table-wrap,
  #sec-ventas .table-wrap { overflow: visible; border: 0; border-radius: 0; }

  #sec-compras .table,
  #sec-ventas .table { display: block; min-width: 0; width: 100%; }

  /* Los encabezados quedan solo para lectores de pantalla (cada celda trae su propia etiqueta). */
  #sec-compras .table thead,
  #sec-ventas .table thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }

  #sec-compras .table tbody,
  #sec-ventas .table tbody { display: flex; flex-direction: column; gap: 0.85rem; }

  #sec-compras .table tbody tr,
  #sec-ventas .table tbody tr {
    display: flex; flex-direction: column; min-width: 0;
    padding: 0.35rem 1rem 0.6rem; background: #0f1218;
    border: 1px solid var(--border); border-radius: 12px;
  }
  #sec-compras .table tbody tr:hover,
  #sec-ventas .table tbody tr:hover { background: #0f1218; }

  #sec-compras .table td,
  #sec-ventas .table td {
    display: flex; flex-direction: column; align-items: stretch; gap: 0.35rem; min-width: 0;
    padding: 0.7rem 0; border-bottom: 1px solid var(--border);
    overflow-wrap: anywhere; word-break: normal;
  }
  #sec-compras .table tbody tr td:last-child,
  #sec-ventas .table tbody tr td:last-child { border-bottom: 0; padding-bottom: 0.2rem; }

  /* Etiqueta de cada fila */
  #sec-compras .table td::before,
  #sec-ventas .table td::before {
    content: attr(data-label); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase;
    color: var(--text-faint);
  }
  #sec-compras .table td:not([data-label])::before,
  #sec-ventas .table td:not([data-label])::before { display: none; }

  /* La entrada es el título de la tarjeta */
  #sec-compras .table td:first-child,
  #sec-ventas .table td:first-child { font-size: 1.02rem; font-weight: 600; line-height: 1.3; }
  #sec-compras .table td:first-child::before,
  #sec-ventas .table td:first-child::before { display: none; }

  /* Orden pedido: Entrada, Precio/Total, Estado, ENTREGA, fecha, Acciones */
  #sec-ventas .table td:nth-child(1), #sec-compras .table td:nth-child(1) { order: 1; }
  #sec-ventas .table td:nth-child(2), #sec-compras .table td:nth-child(2) { order: 2; }
  #sec-ventas .table td:nth-child(3), #sec-compras .table td:nth-child(3) { order: 3; }
  #sec-ventas .table td:nth-child(5) { order: 4; }  /* Mis ventas: Entrega */
  #sec-ventas .table td:nth-child(4) { order: 5; }  /* Mis ventas: Publicada */
  #sec-ventas .table td:nth-child(6) { order: 6; }  /* Mis ventas: Acciones */
  #sec-compras .table td:nth-child(5) { order: 4; } /* Mis compras: Entrega */
  #sec-compras .table td:nth-child(4) { order: 5; } /* Mis compras: Pagada */

  /* Sin bloques vacíos */
  #sec-compras .table td.celda-vacia,
  #sec-ventas .table td.celda-vacia { display: none; }
  #sec-compras .table td.empty,
  #sec-ventas .table td.empty { display: block; padding: 1.4rem 0; text-align: center; border-bottom: 0; }

  /* Bloque ENTREGA: a todo el ancho, sin mínimos que fuercen scroll horizontal */
  #sec-compras .celda-timeline, #sec-ventas .celda-timeline { min-width: 0; width: 100%; }
  #sec-compras .timeline, #sec-ventas .timeline { max-width: none; }
  #sec-compras .timeline__ayuda p, #sec-ventas .timeline__ayuda p,
  #sec-compras .confirm-stack .confirm-tag, #sec-ventas .confirm-stack .confirm-tag { max-width: none; }
  #sec-compras .confirm-stack, #sec-ventas .confirm-stack { align-items: stretch; width: 100%; }
  #sec-compras .confirm-stack .confirm-tag--ok, #sec-ventas .confirm-stack .confirm-tag--ok,
  #sec-compras .confirm-stack .confirm-tag--no, #sec-ventas .confirm-stack .confirm-tag--no { align-self: flex-start; }
  #sec-compras .buyer-email, #sec-ventas .buyer-email { word-break: break-all; }

  /* Botones de las tarjetas: a ancho completo y con área táctil de al menos 44 px */
  #sec-compras .table td .btn,
  #sec-ventas .table td .btn {
    width: 100%; min-height: 44px; justify-content: center; text-align: center; white-space: normal;
  }
  #sec-compras .table td .actions--stack,
  #sec-ventas .table td .actions--stack { align-items: stretch; width: 100%; }
}

/* =========================================================
   MIS COMPRAS / MIS VENTAS en ESCRITORIO (min-width: 641px; el celular usa el bloque anterior y no cambia)
   Cada fila pasa a ser una grilla: fila principal COMPACTA (alineada arriba) + una segunda fila con el bloque ENTREGA
   a todo el ancho (acciones a la izquierda, línea de tiempo a la derecha). Misma estructura de DOM que ya arma renderTabla():
   tr > td[data-label]; el td de ENTREGA es el 5.º. Sin scroll horizontal.
   ========================================================= */
@media (min-width: 641px) {
  #sec-ventas  { --cols-ventas: minmax(0, 2fr) minmax(0, 1.2fr) minmax(0, 1.3fr) minmax(0, 1.3fr) minmax(9rem, 1fr); }
  #sec-compras { --cols-compras: minmax(0, 2fr) minmax(0, 1.2fr) minmax(0, 1.3fr) minmax(0, 1.3fr); }

  #sec-compras .table-wrap,
  #sec-ventas .table-wrap { overflow: visible; border: 0; border-radius: 0; }

  #sec-compras .table,
  #sec-ventas .table { display: block; min-width: 0; width: 100%; }

  /* Encabezado: mismas columnas que las filas; la columna ENTREGA ya no existe como columna */
  #sec-compras .table thead,
  #sec-ventas .table thead { display: block; }
  #sec-ventas .table thead tr  { display: grid; grid-template-columns: var(--cols-ventas); column-gap: 1rem; padding: 0 1.1rem; border-bottom: 1px solid var(--border); }
  #sec-compras .table thead tr { display: grid; grid-template-columns: var(--cols-compras); column-gap: 1rem; padding: 0 1.1rem; border-bottom: 1px solid var(--border); }
  #sec-compras .table th,
  #sec-ventas .table th { padding: 0.85rem 0; background: none; border-bottom: 0; white-space: normal; }
  #sec-compras .table th:nth-child(5),
  #sec-ventas .table th:nth-child(5) { display: none; }

  /* Cada operación = una tarjeta (borde y fondo propios) separada de la siguiente */
  #sec-compras .table tbody,
  #sec-ventas .table tbody { display: flex; flex-direction: column; gap: 0.9rem; padding-top: 0.9rem; }
  #sec-compras .table tbody tr,
  #sec-ventas .table tbody tr {
    display: grid; column-gap: 1rem; align-items: start; min-width: 0;
    padding: 0.95rem 1.1rem; background: #0f1218; border: 1px solid var(--border); border-radius: 12px;
  }
  #sec-ventas .table tbody tr  { grid-template-columns: var(--cols-ventas); }
  #sec-compras .table tbody tr { grid-template-columns: var(--cols-compras); }
  #sec-compras .table tbody tr:hover,
  #sec-ventas .table tbody tr:hover { background: #0f1218; }

  #sec-compras .table td,
  #sec-ventas .table td {
    display: block; min-width: 0; padding: 0; border: 0; vertical-align: top; align-self: start;
    overflow-wrap: anywhere;
  }

  /* Fila principal: ACCIONES en la última columna de la primera fila (el "—" se queda, pero no estira nada) */
  #sec-ventas .table td:nth-child(6) { grid-column: 5; grid-row: 1; }

  /* Segunda fila: ENTREGA a todo el ancho, con título y separador */
  #sec-compras .table td:nth-child(5),
  #sec-ventas .table td:nth-child(5) {
    grid-column: 1 / -1; grid-row: 2; margin-top: 0.9rem; padding-top: 0.85rem; border-top: 1px dashed var(--border-strong);
  }
  #sec-compras .table td:nth-child(5)::before,
  #sec-ventas .table td:nth-child(5)::before {
    content: attr(data-label); display: block; margin-bottom: 0.6rem;
    font-size: 0.7rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-faint);
  }
  /* Sin entrega que mostrar ("—"): no hay segunda fila ni espacio */
  #sec-compras .table td.celda-vacia:nth-child(5),
  #sec-ventas .table td.celda-vacia:nth-child(5) { display: none; }

  /* "Todavía no hay movimientos" */
  #sec-compras .table td.empty,
  #sec-ventas .table td.empty { grid-column: 1 / -1; padding: 1.4rem 0; text-align: center; }

  /* Bloque ENTREGA en dos columnas: izquierda = acciones y plazo; derecha = línea de tiempo y fechas de cobro */
  #sec-compras .celda-timeline,
  #sec-ventas .celda-timeline {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 0.7rem 2.25rem; align-items: start;
    min-width: 0; width: 100%;
  }
  #sec-compras .celda-timeline > .confirm-stack,
  #sec-ventas .celda-timeline > .confirm-stack,
  #sec-compras .celda-timeline > .entrega-plazo,
  #sec-ventas .celda-timeline > .entrega-plazo { grid-column: 1; }
  #sec-compras .celda-timeline > .timeline,
  #sec-ventas .celda-timeline > .timeline { grid-column: 2; grid-row: 1 / span 3; max-width: none; }
  /* Sin acciones (p. ej. reembolsos): la línea de tiempo usa todo el ancho */
  #sec-compras .celda-timeline--solo,
  #sec-ventas .celda-timeline--solo { grid-template-columns: minmax(0, 1fr); }
  #sec-compras .celda-timeline--solo > .timeline,
  #sec-ventas .celda-timeline--solo > .timeline { grid-column: 1; grid-row: auto; }

  /* Plazo límite + cuenta regresiva: a la izquierda (en la línea de tiempo se ocultan para no repetirlos) */
  #sec-compras .entrega-plazo,
  #sec-ventas .entrega-plazo { display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem; }
  .timeline__plazo { display: none; }
  .entrega-plazo__texto { font-size: 0.8rem; line-height: 1.4; color: var(--text-dim); }
}

/* El bloque de plazo duplicado solo existe en escritorio; en celular el plazo se ve dentro de la línea de tiempo (sin cambios) */
.entrega-plazo { display: none; }
@media (min-width: 641px) {
  #sec-compras .entrega-plazo,
  #sec-ventas .entrega-plazo { display: flex; }
}

/* Un campo suelto dentro de un bloque en columna (vincular compra, motivo de liberación): sin esto el flex-basis se vuelve altura */
.disputa-parte .user-search { flex: 0 0 auto; width: 100%; }
