:root {
  --azul: #000000;
  --azul-claro: #111111;
  --acento: #c1121f;
  --fondo: #e5e5e5;
  --superficie: #ffffff;
  --texto: #1a1a1a;
  --muted: #666666;
  --borde: #d0d0d0;
  --ok: #1c7a4a;
  --error: #b4232b;
  --radio: 10px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--fondo);
  color: var(--texto);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  display: flex;
  flex-direction: column;
}

a { color: var(--azul-claro); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Cabecera ---------- */
.top {
  background: var(--azul);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .18);
}

.barra {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

.brand {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding-left: 86px;
  min-height: 38px;
  color: #fff;
  font-weight: 700;
  letter-spacing: .02em;
  font-size: 1.12rem;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }

.brand-logo {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--acento);
  color: #fff;
  font-size: .95rem;
  font-weight: 800;
  letter-spacing: -.03em;
}
img.brand-logo {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  display: block;
  width: 76px;
  height: 76px;
  background: none;
  border-radius: 0;
  object-fit: contain;
}

.hamburguesa {
  display: none;
  margin-left: auto;
  width: 42px;
  height: 38px;
  padding: 8px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}
.hamburguesa span {
  display: block;
  height: 2px;
  margin: 4px 0;
  background: #fff;
  border-radius: 2px;
}

.menu {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.menu a {
  color: #cccccc;
  padding: 8px 12px;
  border-radius: 7px;
  font-size: .94rem;
}
.menu a:hover, .menu a.activo {
  background: rgba(255,255,255,.14);
  color: #fff;
  text-decoration: none;
}
.menu a.salir { margin-left: auto; color: #ffc4ae; }
.usuario-barra {
  color: #aaaaaa;
  font-size: .78rem;
  white-space: nowrap;
}
.menu a.salir { margin-left: 0; }

/* ---------- Contenido ---------- */
.wrap {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 40px;
  flex: 1;
}

h1 {
  margin: 0 0 22px;
  font-size: 1.6rem;
  color: #c00000;
}
h2 { font-size: 1.15rem; color: var(--azul); margin: 0 0 14px; }

.tarjeta {
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 22px;
  box-shadow: 0 3px 14px rgba(0, 0, 0, .05);
  margin-bottom: 20px;
}

.rejilla {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.dato {
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 18px 20px;
}
.dato strong {
  display: block;
  font-size: 2rem;
  color: var(--azul-claro);
  line-height: 1.1;
}
.dato span { color: var(--muted); font-size: .9rem; }

/* ---------- Formularios ---------- */
.campo { margin-bottom: 14px; }
.campo label {
  display: block;
  margin-bottom: 5px;
  font-size: .88rem;
  font-weight: 600;
  color: #444444;
}
input[type="text"], input[type="password"], input[type="email"], select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--borde);
  border-radius: 7px;
  background: #fff;
  color: var(--texto);
  font: inherit;
}
input:focus, select:focus {
  outline: 2px solid rgba(0,0,0,.25);
  border-color: var(--azul-claro);
}

/* Ojo para mostrar/ocultar contraseñas */
.pwd-campo { position: relative; }
.pwd-campo input { padding-right: 44px; }
.pwd-ojo {
  position: absolute;
  right: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #555;
  cursor: pointer;
}
.pwd-ojo:hover { background: #eee; color: #000; }
.pwd-ojo.visto { color: #c1121f; }
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.checkbox input { width: 18px; height: 18px; }

.boton, button.boton {
  display: inline-block;
  border: 0;
  border-radius: 7px;
  background: var(--azul-claro);
  color: #fff;
  padding: 10px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.boton:hover { background: var(--azul); color: #fff; text-decoration: none; }
.boton.secundario { background: #eeeeee; color: var(--texto); }
.boton.secundario:hover { background: #dddddd; }
.boton.excel { background: #16a34a; color: #fff; }
.boton.excel:hover { background: #12813c; color: #fff; }
.acciones-excel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border: 1px solid #b7d7bf;
  border-radius: 7px;
  background: #f1f8f3;
}
.acciones-excel .boton.excel {
  height: 28px;
  padding: 0 8px;
  font-size: .8rem;
}
.acciones-excel select {
  width: auto;
  max-width: 130px;
  height: 20px;
  padding: 0 2px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  color: var(--texto);
  font: inherit;
  font-size: .72rem;
}
.boton.peligro { background: var(--error); }
.boton.peligro:hover { background: #8f1c22; }
.boton.chico { padding: 5px 10px; font-size: .82rem; }

.acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 6px;
}

.ayuda { color: var(--muted); font-size: .84rem; margin-top: 4px; }

.caja-live { color: var(--muted); font-size: .8rem; margin: 0 0 10px; }
.caja-live.error { color: var(--error); }

/* ---------- Alertas ---------- */
.alerta {
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 18px;
  border: 1px solid transparent;
  font-size: .94rem;
}
.alerta-error { background: #fdecec; border-color: #f3c2c4; color: var(--error); }
.alerta-ok { background: #e8f6ee; border-color: #bce3cc; color: var(--ok); }
.alerta-info { background: #f0f0f0; border-color: #cccccc; color: var(--azul); }

.etiqueta {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 700;
  background: #eeeeee;
  color: #444444;
}
.etiqueta.admin { background: #fdeee4; color: #a94812; }
.etiqueta.inactivo { background: #f3dede; color: var(--error); }

/* ---------- Tablas ---------- */
.tabla-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
}
th, td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--borde);
  text-align: left;
  vertical-align: middle;
}
th {
  color: var(--muted);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: #f5f5f5;
}
tr:last-child td { border-bottom: 0; }
td.acciones-tabla { white-space: nowrap; }
td.acciones-tabla form { display: inline; }

.vacio { color: var(--muted); text-align: center; padding: 28px 10px; }

/* ---------- Login ---------- */
.login-fondo {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
  background: var(--fondo);
}
.login-caja {
  width: 100%;
  max-width: 400px;
  background: var(--superficie);
  border-radius: 14px;
  padding: 30px;
  box-shadow: 0 18px 50px rgba(0,0,0,.25);
}
.login-banner {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 190px;
  object-fit: contain;
  object-position: center;
  margin: 0 auto 14px;
}
.login-caja .subtitulo {
  text-align: center;
  color: var(--muted);
  font-size: .88rem;
  margin-bottom: 24px;
}
.login-caja .boton {
  width: 100%;
  margin-top: 6px;
  background: #000;
  color: #fff;
}
.login-caja .boton:hover,
.login-caja .boton:focus {
  background: #1a1a1a;
  color: #fff;
}

/* ---------- Pie ---------- */
.pie-sitio {
  text-align: center;
  padding: 16px;
  color: var(--muted);
  font-size: .82rem;
  border-top: 1px solid var(--borde);
}
.pie-sitio a { color: var(--muted); text-decoration: none; }
.pie-sitio a:hover { color: var(--acento); text-decoration: underline; }

/* Link de CHQ: abre la ventana flotante con el número de cheque */
.ver-cheque {
  color: inherit;
  text-decoration: underline dotted rgba(0, 0, 0, .35);
  text-underline-offset: 3px;
  cursor: pointer;
}
.ver-cheque:hover { color: var(--acento); text-decoration-color: var(--acento); }
.rep-modal-datos {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 12px;
  margin: 0;
  font-size: .92rem;
}
.rep-modal-datos dt { color: var(--muted); font-weight: 600; }
.rep-modal-datos dd { margin: 0; word-break: break-word; }
.campo[hidden] { display: none; }

/* ---------- Móvil ---------- */
@media (max-width: 720px) {
  .hamburguesa { display: block; }
  .menu {
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 4px 14px 14px;
  }
  .menu.abierto { display: flex; }
  .menu a { margin-left: 0; }
  .menu a.salir { margin-left: 0; }
  .wrap { padding: 20px 14px 32px; }
  .tarjeta { padding: 16px; }
  h1 { font-size: 1.35rem; }
  th, td { padding: 9px 8px; }
}

/* Teléfono apaisado (poca altura): menú hamburguesa y cabecera baja. */
@media (orientation: landscape) and (max-height: 500px) {
  .hamburguesa { display: block; }
  .menu {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 4px 14px 10px;
    background: var(--azul);
  }
  .menu.abierto { display: flex; }
  .menu a.salir { margin-left: 0; }
  .barra { padding: 4px 14px; }
  .brand { min-height: 30px; padding-left: 62px; font-size: .95rem; }
  img.brand-logo { width: 54px; height: 54px; }
  .top { box-shadow: 0 1px 6px rgba(0, 0, 0, .18); }
}

/* ---------- Iconos de acciones ---------- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.barra-herramientas { padding: 14px 16px; }
.barra-herramientas .acciones { margin: 0; }

.buscador {
  position: relative;
  flex: 1 1 240px;
  min-width: 190px;
}
.buscador input { padding-right: 46px; }
.buscador .boton-icono {
  position: absolute;
  right: 4px;
  top: 4px;
}

.boton-icono {
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--borde);
  border-radius: 8px;
  background: #fff;
  color: var(--azul-claro);
  cursor: pointer;
  flex: 0 0 auto;
}
.boton-icono:hover {
  background: #f0f0f0;
  border-color: #cccccc;
  color: var(--azul);
}
.boton-icono:focus-visible {
  outline: 2px solid var(--azul-claro);
  outline-offset: 2px;
}
.icono { display: block; }
.icono-apagado { color: #96690b; }
.icono-apagado:hover { background: #fff6df; border-color: #ecd493; }
.icono-encendido { color: var(--ok); }
.icono-encendido:hover { background: #e8f6ee; border-color: #bce3cc; }
.icono-peligro { color: var(--error); }
.icono-peligro:hover { background: #fdecec; border-color: #f3c2c4; color: var(--error); }

.iconos-fila {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}
.iconos-fila form { margin: 0; }

/* ---------- Listado en tarjetas (celular) ---------- */
@media (max-width: 760px) {
  .barra-herramientas .buscador { flex: 1 1 100%; }
  .barra-herramientas .boton { flex: 1; text-align: center; }

  .tabla-responsive thead { display: none; }
  .tabla-responsive table,
  .tabla-responsive tbody,
  .tabla-responsive tr,
  .tabla-responsive td { display: block; width: 100%; }

  .tabla-responsive tr {
    border: 1px solid var(--borde);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 12px;
    background: #fff;
  }
  .tabla-responsive td {
    border: 0;
    border-bottom: 1px dashed var(--borde);
    padding: 7px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    white-space: normal;
  }
  .tabla-responsive td::before {
    content: attr(data-label);
    flex: 0 0 92px;
    color: var(--muted);
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .04em;
  }
  .tabla-responsive td:last-child { border-bottom: 0; }
  .tabla-responsive td.acciones-tabla { justify-content: flex-start; }
  .tabla-responsive td.acciones-tabla::before { flex-basis: 100%; }
  .tabla-responsive td.vacio { text-align: center; }
  .tabla-responsive td.vacio::before { display: none; }

  .iconos-fila { gap: 10px; }
  .boton-icono { width: 28px; height: 28px; }
}

@media (max-width: 480px) {
  .login-fondo { padding: 14px 12px; align-items: center; }
  .login-caja { padding: 20px 18px; border-radius: 12px; }
  .login-banner { max-height: 130px; margin-bottom: 10px; }
  .login-caja .subtitulo { margin-bottom: 18px; }
  .login-caja input { font-size: 16px; }
  .login-caja .boton { min-height: 44px; }
}

/* ---------- Listado de usuarios ---------- */
.lista-usuarios {
  list-style: none;
  margin: 0;
  padding: 0;
}
.lista-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--borde);
}
.lista-item:last-child { border-bottom: 0; }
.lista-datos {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  min-width: 0;
  flex: 1 1 auto;
}
.lista-usuario { color: #000; word-break: break-word; }
.lista-nombre { color: var(--texto); font-size: .9rem; overflow-wrap: anywhere; }
.lista-acciones {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  max-width: 100%;
}
.lista-acciones form { margin: 0; }

/* ---------- Rol (círculo) y Estado (icono) ---------- */
.rol-chip {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
}
.rol-admin { background: #c1121f; }
.rol-user { background: #1c7a4a; }

.estado-celda { white-space: nowrap; }
.estado-celda form { margin: 0; }
.estado-btn {
  width: 20px;
  height: 20px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.estado-on { color: #1c7a4a; }
.estado-off { color: #c1121f; }
.estado-btn:hover { background: #eee; }

/* Acciones siempre visible */
.tabla-usuarios .col-acciones,
.tabla-usuarios .acciones-tabla {
  position: sticky;
  right: 0;
  z-index: 1;
  background: #fff;
}
.tabla-usuarios .boton-icono { width: 24px; height: 24px; }

/* ---------- Columnas según ancho de pantalla ---------- */
@media (max-width: 760px) {
  .tabla-usuarios .col-ingreso { display: none; }
  .tabla-usuarios th,
  .tabla-usuarios td {
    padding: 5px 4px;
    font-size: .72rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
  }
  .tabla-usuarios .acciones-tabla { white-space: nowrap; }
  .tabla-usuarios .iconos-fila { gap: 2px; }
}

/* ---------- Planilla de cobranza ---------- */
.tabla-cobranza .col-acciones,
.tabla-cobranza .acciones-tabla {
  position: sticky;
  right: 0;
  z-index: 1;
  background: #fff;
}
.tabla-cobranza .boton-icono { width: 20px; height: 20px; }
.tabla-cobranza tfoot td { background: #f0f0f0; }
.monto-salida { color: #c00000; font-weight: 700; }
mark.resalte { background: #c00000; color: #fff; padding: 0 2px; border-radius: 3px; }
.tabla-cobranza th a.orden { color: inherit; text-decoration: none; }
.tabla-cobranza th a.orden:hover { text-decoration: underline; }
.filtros-dia {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 14px;
}
.filtros-dia .campo { margin: 0; flex: 1 1 170px; min-width: 140px; }
.filtros-dia .acciones { margin: 0; }
/* Buscador, proveedor y filas: misma altura */
.filtros-dia input[type="search"],
.filtros-dia input[type="text"],
.filtros-dia select {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--borde);
  border-radius: 7px;
  background: #fff;
  color: var(--texto);
  font: inherit;
}

/* El selector y el botón del Excel: un poco más chicos que los filtros. */
.filtros-dia .acciones-excel {
  height: 44px;
  align-items: center;
}
.filtros-dia .acciones-excel .boton.excel {
  height: 32px;
  padding: 0 10px;
  font-size: .84rem;
}
.filtros-dia .acciones-excel select {
  height: 32px;
  max-width: 150px;
  padding: 0 6px;
  font-size: .82rem;
}

@media (max-width: 760px) {
  .filtros-dia {
    flex-direction: column;
    align-items: stretch;
  }
  .filtros-dia .campo { flex: 1 1 100%; min-width: 0; width: 100%; }
  .filtros-dia input,
  .filtros-dia select { width: 100%; max-width: 100%; }
  .filtros-dia .acciones { width: 100%; }
}
.tabla-cobranza tbody tr:nth-child(odd) { background: #eaf4fb; }
.tabla-cobranza tbody tr:nth-child(even) { background: #ffffff; }
.tabla-cobranza tbody tr.fila-activa { background: #ffe9e9; }
.tabla-dias a.link-dia {
  color: #0000ee;
  text-decoration: underline;
  font-weight: 700;
  cursor: pointer;
}
.tabla-dias a.link-dia:hover { color: #c00000; }
/* Calendario (flatpickr) */
input.calendario-campo {
  width: 170px;
  max-width: 100%;
  padding-right: 30px;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px 16px;
  cursor: pointer;
}
.flatpickr-calendar { font-family: inherit; }
.fp-barra-hoy {
  padding: 6px 8px;
  border-top: 1px solid #e5e5e5;
  text-align: center;
  background: #fff;
}
.fp-hoy {
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: #000;
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.fp-hoy:hover { background: #c00000; }
.flatpickr-day.selected,
.flatpickr-day.selected:hover {
  background: #c00000;
  border-color: #c00000;
}

/* Las tablas de caja deben caber en un teléfono sin desplazar */
.tabla-cobranza { table-layout: fixed; width: 100%; }
.tabla-cobranza .col-acciones,
.tabla-cobranza .acciones-tabla { width: 46px; }
.tabla-cobranza .col-mec { width: 96px; }

@media (max-width: 760px) {
  .tabla-cobranza { table-layout: auto; }
  .tabla-cobranza .col-secundaria,
  .tabla-cobranza .col-acciones,
  .tabla-cobranza .acciones-tabla { display: none !important; }
  .tabla-cobranza th,
  .tabla-cobranza td {
    padding: 5px 3px;
    font-size: .68rem;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .tabla-cobranza .col-mec { width: auto; }
}

/* Teléfono en vertical (aunque el ancho sea grande) */
@media (orientation: portrait) and (pointer: coarse) {
  .tabla-cobranza .col-secundaria,
  .tabla-cobranza .col-acciones,
  .tabla-cobranza .acciones-tabla { display: none !important; }
  .tabla-cobranza th,
  .tabla-cobranza td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* En el teléfono la tabla llega hasta el borde de la pantalla */
@media (max-width: 760px) {
  .tarjeta:has(.tabla-cobranza) { padding-left: 6px; padding-right: 6px; }
  .tabla-cobranza { width: 100%; }
}

/* ---------- Módulo Repuestos ---------- */
.rep-cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.rep-tabla { font-size: .7rem; }
.rep-tabla th,
.rep-tabla td {
  padding: 2px 6px;
  line-height: 1.3;
  white-space: normal;
  vertical-align: middle;
}
.rep-tabla th {
  padding: 8px 6px;
  font-size: .62rem;
  white-space: nowrap;
}
.rep-tabla .rep-num,
.rep-tabla .num,
.rep-tabla .precio { text-align: right; white-space: nowrap; }
.rep-tabla th.rep-num { text-align: right; }
.rep-tabla tbody tr:nth-child(odd) { background: #fafafa; }
.rep-tabla tbody tr:hover { background: #fff2f2; }
.rep-lista tbody tr:nth-child(odd) { background: #e8f5e9; }
.rep-lista tbody tr:nth-child(even) { background: #ffffff; }
.rep-lista tbody tr:hover { background: #fff2f2; }

/* Cuadro rojo con la X, solo para borrar (igual que Ferretería Paula) */
.col-borrar { text-align: center; white-space: nowrap; width: 26px; }
.col-borrar form { display: inline-block; margin: 0; }
.btn-borrar-x {
  position: relative;
  display: inline-block;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: var(--acento);
  cursor: pointer;
  vertical-align: middle;
}
.btn-borrar-x::before,
.btn-borrar-x::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 13px;
  height: 2.5px;
  border-radius: 1px;
  background: #fff;
}
.btn-borrar-x::before { transform: translate(-50%, -50%) rotate(45deg); }
.btn-borrar-x::after  { transform: translate(-50%, -50%) rotate(-45deg); }
.btn-borrar-x:hover { background: #8f1c22; }
.btn-borrar-x:focus-visible { outline: 2px solid #93c5fd; outline-offset: 1px; }
.btn-borrar-x--sm { width: 18px; height: 18px; }
.btn-borrar-x--sm::before,
.btn-borrar-x--sm::after { width: 11px; height: 2px; }

/* Lista de proveedores: botones con texto y ajuste en pantallas chicas */
.acciones-proveedor {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
  align-items: center;
}
.acciones-proveedor form { margin: 0; }
.cols-proveedor th.rep-acciones { text-align: right; }
.acciones-proveedor .boton {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  font-size: .72rem;
  line-height: 1;
  border-radius: 5px;
}
.acciones-proveedor .boton.verde {
  background: #16a34a;
  color: #fff;
}
.acciones-proveedor .boton.verde:hover {
  background: #12813c;
  color: #fff;
}
.btn-borrar-x--sm { width: 20px; height: 20px; }
@media (orientation: portrait) and (max-width: 900px) {
  .cols-proveedor th:nth-child(2), .cols-proveedor th:nth-child(4),
  .cols-proveedor td:nth-child(2), .cols-proveedor td:nth-child(4) { display: none; }
}

/* Solo teléfono en VERTICAL: se quitan columnas, igual que Ferretería Paula.
   Acostado (horizontal) o en escritorio se ven todas las columnas. */
@media (orientation: portrait) and (max-width: 900px) {
  /* Admin: se ocultan #, Código, Compra y %. Quedan Repuesto, Marca, Venta y borrar. */
  .rep-lista.cols-admin th:nth-child(1), .rep-lista.cols-admin th:nth-child(2),
  .rep-lista.cols-admin th:nth-child(5), .rep-lista.cols-admin th:nth-child(6),
  .rep-lista.cols-admin td:nth-child(1), .rep-lista.cols-admin td:nth-child(2),
  .rep-lista.cols-admin td:nth-child(5), .rep-lista.cols-admin td:nth-child(6) { display: none; }

  /* Usuario: se ocultan # y Código. Quedan Repuesto, Marca y Venta. */
  .rep-lista.cols-basico th:nth-child(1), .rep-lista.cols-basico th:nth-child(2),
  .rep-lista.cols-basico td:nth-child(1), .rep-lista.cols-basico td:nth-child(2) { display: none; }
}
.rep-precio { font-size: 1.05rem; font-weight: 700; color: #000; }
.rep-ficha {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 8px 16px;
  margin: 0 0 18px;
}
.rep-ficha dt { color: var(--muted); font-weight: 600; }
.rep-ficha dd { margin: 0; }
.rep-foto-caja { margin: 8px 0 18px; }
.rep-foto-grande {
  display: block;
  max-width: min(100%, 360px);
  max-height: 360px;
  border-radius: 10px;
  border: 1px solid var(--borde);
  object-fit: contain;
  background: #fff;
}
.rep-ver-foto { color: var(--acento); font-weight: 700; }
.rep-ver-foto:hover { color: #7d0d17; }
.rep-paginacion {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
}
.rep-pagina {
  min-width: 34px;
  text-align: center;
  padding: 6px 8px;
  border: 1px solid var(--borde);
  border-radius: 8px;
  background: #fff;
  font-weight: 600;
}
.rep-pagina:hover { text-decoration: none; border-color: var(--acento); }
.rep-pagina.activo { background: var(--azul); color: #fff; border-color: var(--azul); }
.rep-puntos { color: var(--muted); padding: 0 2px; }
.rep-sin-plantilla { color: #a94812; font-weight: 700; }
.rep-mapeo-grupo {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}
.rep-letra { text-transform: uppercase; }
.rep-estado-nuevo { background: #e6f4ec; color: #1c7a4a; }
.rep-estado-actualizar { background: #fdeee4; color: #a94812; }
.rep-cargando {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, .62);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 20px;
}
.rep-cargando[hidden] { display: none; }
.rep-cargando p { margin: 0; font-size: 1.1rem; font-weight: 700; }
.rep-cargando small { opacity: .85; max-width: 320px; }
.rep-cargando-circulo {
  width: 46px;
  height: 46px;
  border: 5px solid rgba(255, 255, 255, .3);
  border-top-color: var(--acento);
  border-radius: 50%;
  animation: rep-giro .8s linear infinite;
}
@keyframes rep-giro { to { transform: rotate(360deg); } }

/* ---------- Ventana flotante de foto ---------- */
.rep-modal[hidden] { display: none; }
.rep-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 18px;
}
.rep-modal-fondo { position: absolute; inset: 0; background: rgba(0, 0, 0, .72); }
.rep-modal-caja {
  position: relative;
  z-index: 1;
  width: min(92vw, 860px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .4);
}
.rep-modal-cab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--azul);
  color: #fff;
}
.rep-modal-cerrar {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.rep-modal-cuerpo {
  padding: 12px;
  overflow: auto;
  background: #f7f7f7;
  display: grid;
  place-items: center;
}
.rep-modal-cuerpo img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}
.rep-modal-pie { padding: 10px 16px; border-top: 1px solid var(--borde); text-align: right; }
.rep-modal-pie a { color: var(--acento); font-weight: 700; }
body.rep-modal-abierto { overflow: hidden; }

@media (max-width: 760px) {
  .rep-ficha { grid-template-columns: 1fr; gap: 2px; }
  .rep-ficha dd { margin-bottom: 8px; }
  .rep-tabla th,
  .rep-tabla td { padding: 2px 4px; font-size: .7rem; }
  .rep-tabla th { padding: 6px 4px; font-size: .6rem; }
}

/* ---------- Menú agrupado: Contable / Repuestos / Sistema ---------- */
.menu-grupo {
  display: flex;
  align-items: center;
  gap: 4px;
}
.menu-grupo + .menu-grupo {
  border-left: 1px solid rgba(255, 255, 255, .18);
  margin-left: 6px;
  padding-left: 10px;
}
@media (max-width: 760px) {
  .menu-grupo {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
  }
  .menu-grupo + .menu-grupo {
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, .38);
    margin: 6px 0 0;
    padding: 8px 0 0;
  }
}

/* ---------- Formulario de proveedores y plantillas ---------- */
.rep-form-proveedor label {
  display: block;
  margin-bottom: 14px;
  font-size: .9rem;
  font-weight: 600;
  color: #1e293b;
}
.rep-form-proveedor input[type="text"],
.rep-form-proveedor input[type="number"],
.rep-form-proveedor input[type="file"],
.rep-form-proveedor select,
.rep-form-proveedor textarea {
  width: 100%;
  max-width: 520px;
  padding: 9px 11px;
  margin-top: 4px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: .95rem;
  font-family: inherit;
  background: #fff;
  color: #1e293b;
}
.rep-form-proveedor textarea { min-height: 80px; }
.rep-form-proveedor input:focus,
.rep-form-proveedor select:focus,
.rep-form-proveedor textarea:focus {
  outline: 2px solid #93c5fd;
  border-color: #2563eb;
}
.rep-form-proveedor .dos-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}
.rep-form-proveedor .mini-mapa {
  font-size: .86rem;
  color: var(--muted);
  margin: 0 0 14px;
}
.rep-form-proveedor .mini-mapa b { color: #b45309; }
.rep-form-proveedor .dos-col.mapeo { gap: 0 10px; margin-top: 6px; }
.rep-form-proveedor .dos-col.mapeo > .grupo { padding: 6px; border-radius: 10px; }
.rep-form-proveedor .dos-col.mapeo > .grupo > * { margin-bottom: 4px; }
.rep-form-proveedor .dos-col.mapeo > .grupo > :last-child { margin-bottom: 0; }
.rep-form-proveedor .dos-col.mapeo label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.rep-form-proveedor .dos-col.mapeo > .grupo > :nth-child(odd) { background: #dbeafe; }
.rep-form-proveedor .dos-col.mapeo > .grupo > :nth-child(even) { background: #eff6ff; }
.rep-form-proveedor .dos-col.mapeo > .grupo + .grupo > :nth-child(odd) { background: #fef9c3; }
.rep-form-proveedor .dos-col.mapeo > .grupo + .grupo > :nth-child(even) { background: #fefce8; }
.rep-form-proveedor .dos-col.mapeo input {
  width: 44px;
  max-width: 44px;
  margin: 0;
  padding: 3px 6px;
  text-align: center;
  font-size: .9rem;
  font-weight: 600;
  background: #fff;
}
@media (max-width: 760px) {
  .rep-form-proveedor .dos-col { grid-template-columns: 1fr; }
  .rep-form-proveedor .dos-col.mapeo .grupo + .grupo { margin-top: 8px; }
}
