/* Ventas Lucero Libros — interno, rápido, usable con guantes en la feria.
   Estética "limpia neutra": fondo claro, tarjetas blancas, acento teal.
   Para cambiar el color de acento, tocá solo --accent / --accent-osc / --accent-bg. */
:root {
  --bg: #f5f6f8;          /* fondo de página */
  --surface: #ffffff;     /* tarjetas */
  --surface-2: #f3f5f7;   /* hover / encabezados sutiles */
  --text: #111827;        /* texto principal */
  --text-2: #6b7280;      /* texto secundario */
  --text-3: #9aa3af;      /* pistas / placeholder */
  --border: #e5e8ec;      /* borde fino */
  --border-2: #d5dae1;    /* borde de énfasis / hover */
  --accent: #0e7c66;      /* acento (botones, activo) */
  --accent-osc: #0b6353;  /* acento hover */
  --accent-bg: #e8f2ee;   /* superficie de acento clara */
  --accent-text: #0e5c48; /* texto sobre acento claro */
  --ok: #0e7c66;
  --ok-bg: #e8f2ee;
  --error: #c0392b;
  --error-bg: #fbecea;
  --pendiente: #b4801e;
  --pendiente-bg: #fbf4e2;
  --pendiente-text: #8a5a12;
  --radius: 10px;
  --radius-card: 12px;
  --shadow-card: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.05);
  --shadow-pop: 0 12px 34px rgba(16,24,40,.18);
  /* alias de los nombres viejos, por si algún estilo los usa */
  --papel: var(--bg); --tinta: var(--text); --superficie: var(--surface);
  --borde: var(--border); --madera: var(--accent); --madera-osc: var(--accent-osc);
}

* { box-sizing: border-box; }
html { font-size: 17px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---- barra superior ---- */
.barra {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--surface);
  color: var(--text);
  padding: 0.55rem 1.1rem;
  border-bottom: 1px solid var(--border);
}
.barra .marca { display: inline-flex; align-items: center; line-height: 0; }
.barra .marca img { height: 2.4rem; width: auto; display: block; }
.barra nav { display: flex; gap: 0.15rem; flex: 1; flex-wrap: wrap; }
.barra nav a {
  color: var(--text-2);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  font-size: 0.95rem;
  transition: background .15s, color .15s;
}
.barra nav a:hover { background: var(--surface-2); color: var(--text); }
.barra nav a.activo { background: var(--accent-bg); color: var(--accent-text); font-weight: 500; }
.barra .quien { font-size: 0.85rem; color: var(--text-2); }
.barra .quien a { color: var(--accent-text); margin-left: 0.5rem; }

main { max-width: 64rem; margin: 0 auto; padding: 1.3rem 1rem; }
h1 { font-size: 1.4rem; font-weight: 600; margin: 0.2rem 0 0.9rem; letter-spacing: -0.01em; }
h2 { font-size: 1.08rem; font-weight: 600; margin: 1.6rem 0 0.6rem; }
h3 { font-size: 0.98rem; font-weight: 600; margin: 1.2rem 0 0.5rem; }
.explicacion { color: var(--text-2); font-size: 0.92rem; }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 0.88rem; }

/* ---- controles ---- */
input, select, button {
  font: inherit;
  color: var(--text);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 0.55rem 0.75rem;
  background: var(--surface);
  max-width: 100%;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
input::placeholder { color: var(--text-3); }
input:focus, select:focus, button:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
button { cursor: pointer; }
button:hover { background: var(--surface-2); border-color: var(--border-2); }
button.principal {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 500;
  padding: 0.68rem 1.4rem;
  box-shadow: 0 1px 2px rgba(14,124,102,.25);
}
button.principal:hover { background: var(--accent-osc); border-color: var(--accent-osc); }
button.principal:disabled { opacity: 0.4; cursor: default; box-shadow: none; }
label { display: inline-flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; color: var(--text-2); }
label.radio { flex-direction: row; align-items: center; gap: 0.4rem; font-size: 1rem; color: var(--text); }

/* ---- pantalla de venta ---- */
.fila-escaneo { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.campo-isbn { flex: 1; min-width: 16rem; }
.campo-isbn input {
  font-size: 1.3rem;
  padding: 0.75rem 0.95rem;
  width: 100%;
}
.carrito {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.carrito th {
  padding: 0.6rem 0.8rem;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-2);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.carrito td { padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border); text-align: left; }
.carrito tr:last-child td { border-bottom: none; }
.carrito .num { text-align: right; }
.carrito .titulo small { display: block; color: var(--text-3); font-size: 0.8rem; }
.carrito input.precio { width: 6.5rem; text-align: right; }
.carrito input.cantidad { width: 4rem; text-align: right; }
.carrito tr.pendiente { background: var(--pendiente-bg); }
.chip {
  background: var(--pendiente-bg);
  color: var(--pendiente-text);
  border: 1px solid #eddcb0;
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 500;
}
.quitar { border: none; background: none; color: var(--error); font-size: 1.1rem; padding: 0.2rem 0.4rem; }
.quitar:hover { background: var(--error-bg); }
.carrito-vacio { color: var(--text-3); text-align: center; padding: 1.4rem; }

.cierre {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.total { font-size: 1.3rem; color: var(--text-2); }
.total strong { color: var(--text); font-weight: 600; }
.pago { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.pago .radio { padding: 0.35rem 0.7rem; border-radius: 999px; }
.pago .radio:has(input:checked) { background: var(--accent-bg); color: var(--accent-text); }
.cierre .principal { margin-left: auto; font-size: 1.05rem; }

/* ---- avisos ---- */
.aviso { margin: 0.9rem 0; padding: 0.75rem 0.95rem; border-radius: var(--radius); border: 1px solid; font-size: 0.95rem; }
.aviso.info { border-color: var(--border); background: var(--surface); color: var(--text-2); }
.aviso.ok { border-color: #bfe0d4; background: var(--ok-bg); color: var(--accent-text); }
.aviso.error { border-color: #f0c9c4; background: var(--error-bg); color: var(--error); }
.aviso.pendiente { border-color: #eddcb0; background: var(--pendiente-bg); color: var(--pendiente-text); }
.oculto { display: none; }
.error { color: var(--error); }
.todo-ok { color: var(--ok); font-size: 1.1rem; }

/* ---- listados ---- */
.listado {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  margin: 0.7rem 0 1.2rem;
}
.listado th {
  padding: 0.55rem 0.7rem;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-2);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.listado td { padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--border); text-align: left; font-size: 0.93rem; }
.listado tr:last-child td { border-bottom: none; }
.listado .num { text-align: right; }
.listado.compacto { width: auto; min-width: 24rem; }
.venta-fila.con-pendientes td { background: var(--pendiente-bg); }
.venta-items td { background: var(--surface-2); font-size: 0.85rem; color: var(--text-2); }
.venta-items .item { margin-right: 0.9rem; display: inline-block; }
.venta-items .item.pendiente { color: var(--pendiente-text); font-weight: 600; }
.acciones { white-space: nowrap; }
.acciones button { padding: 0.35rem 0.7rem; font-size: 0.85rem; }

.filtros { display: flex; gap: 0.8rem; align-items: end; flex-wrap: wrap; margin-bottom: 1rem; }
.tarjetas { display: flex; gap: 0.7rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tarjeta {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 0.7rem 1.05rem;
  font-size: 0.82rem;
  color: var(--text-2);
  box-shadow: var(--shadow-card);
}
.tarjeta span { display: block; font-size: 1.35rem; font-weight: 600; color: var(--text); margin-top: 0.1rem; }
.paginas { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.paginas a { padding: 0.32rem 0.7rem; border: 1px solid var(--border-2); border-radius: 8px; text-decoration: none; color: var(--text-2); }
.paginas a:hover { background: var(--surface-2); }
.paginas a.activo { background: var(--accent); color: #fff; border-color: var(--accent); }

.caja-subida {
  background: var(--surface);
  border: 1px dashed var(--border-2);
  border-radius: var(--radius-card);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-start;
}

/* ---- login ---- */
.pantalla-login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: var(--bg);
}
.caja-login {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.2rem;
  width: min(22rem, 92vw);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  box-shadow: var(--shadow-pop);
}
.caja-login h1 { margin: 0; font-size: 1.45rem; }
.logo-login { width: 150px; height: auto; align-self: center; margin: 0.2rem 0 0.4rem; }
.caja-login .sub { margin: 0; color: var(--text-2); font-size: 0.9rem; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.caja-login button { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 500; }
.caja-login button:hover { background: var(--accent-osc); }

/* ---- celular (la feria) ---- */
@media (max-width: 640px) {
  html { font-size: 16px; }
  .barra { padding: 0.45rem 0.7rem; }
  .barra .quien { width: 100%; order: 3; }
  main { padding: 0.8rem 0.7rem; }
  .cierre .principal { width: 100%; margin-left: 0; }
  .carrito th:nth-child(2), .carrito td:nth-child(2) { display: none; } /* fuente: se ve en pendientes */
  .listado th, .listado td { font-size: 0.85rem; padding: 0.45rem; }
  .slots-cierre { grid-template-columns: 1fr; }
}

/* ---- cierre de mes ---- */
.slots-cierre {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  width: 100%;
}
.slots-cierre .slot {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.7rem;
  font-size: 0.9rem;
}
.slots-cierre .slot span { font-weight: 500; color: var(--text-2); }
.boton-descarga {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.65rem 1.1rem;
  font-weight: 500;
  font-size: 1.02rem;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(14,124,102,.25);
}
.boton-descarga:hover { background: var(--accent-osc); }

/* ---- popup: elegir distribuidora cuando un ISBN está en varias ---- */
.modal-fondo {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 50;
}
.modal-fondo.oculto { display: none; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 1.3rem;
  width: min(28rem, 100%);
  box-shadow: var(--shadow-pop);
}
.modal h2 { margin: 0 0 0.3rem; font-size: 1.15rem; }
.modal-opciones { display: flex; flex-direction: column; gap: 0.5rem; margin: 0.9rem 0; }
.opcion-dist {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  text-align: left;
  padding: 0.75rem 0.95rem;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}
.opcion-dist:hover { background: var(--accent-bg); border-color: var(--accent); }
.opcion-dist strong { font-size: 1.05rem; font-weight: 600; color: var(--text); }
.opcion-dist span { font-size: 0.85rem; color: var(--text-2); }
.quitar-modal { width: 100%; background: var(--surface); border: 1px solid var(--border-2); color: var(--error); }
.quitar-modal:hover { background: var(--error-bg); border-color: #f0c9c4; }
