/* ══════════════════════════════════════════════════════════════════════════
   NÚMEROS DE PEDIDO POR CLIENTE — ESTILOS
   Todo con prefijo .ref- / .acceso-referencias para no pisar nada de la
   pantalla de rutas, que ya tiene su propio CSS de 3.000 líneas.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── El botón, haciendo pareja con el de GIAHSA ─────────────────────────── */
.acceso-referencias {
    position: absolute; z-index: 1000;
    top: 170px; left: calc(var(--sidebar-width, 350px) + 20px);
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 15px; border-radius: 8px; cursor: pointer;
    background: #fff; color: #334155; border: 1px solid #cbd5e1;
    font-family: inherit; font-size: .86rem; font-weight: 600;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .12);
    transition: all .2s;
}
.acceso-referencias:hover { background: #f8fafc; border-color: #94a3b8; transform: translateY(-1px); }
.acceso-referencias i { color: #0f766e; }

@media (max-width: 768px) {
    .acceso-referencias { position: fixed; top: 156px; left: 10px; padding: 8px 12px; font-size: .8rem; }
    .acceso-referencias-texto { display: none; }
}

/* ── El desplegable del formulario ──────────────────────────────────────── */
.ref-selector { margin-bottom: 8px; }
.ref-selector[hidden] { display: none; }
.ref-selector select {
    width: 100%; padding: 9px 12px; border-radius: 8px;
    border: 1.5px solid #99f6e4; background: #f0fdfa; color: #115e59;
    font-family: inherit; font-size: .9rem; font-weight: 600; cursor: pointer;
}
.ref-selector select:focus { outline: none; border-color: #0f766e; box-shadow: 0 0 0 3px rgba(15,118,110,.13); }
.ref-pista { display: block; margin-top: 5px; font-size: .8rem; color: #0f766e; font-style: italic; }
.ref-pista:empty { display: none; }

/* ── El panel ───────────────────────────────────────────────────────────── */
.ref-panel { position: fixed; inset: 0; z-index: 5000; display: none; }
.ref-panel.abierto { display: block; }
.ref-panel__fondo { position: absolute; inset: 0; background: rgba(15, 23, 42, .55); }
.ref-panel__caja {
    position: absolute; top: 0; right: 0; bottom: 0; width: min(620px, 100%);
    background: #f8fafc; display: flex; flex-direction: column;
    box-shadow: -12px 0 40px rgba(0,0,0,.25);
    animation: refEntra .28s cubic-bezier(.2,.8,.3,1);
}
@keyframes refEntra { from { transform: translateX(100%); } to { transform: none; } }

.ref-panel__cab {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 18px 22px; background: #fff; border-bottom: 1px solid #e2e8f0;
}
.ref-panel__cab h2 { margin: 0; font-size: 1.08rem; color: #0f172a; display: flex; align-items: center; gap: 10px; }
.ref-panel__cab i { color: #0f766e; }
.ref-cerrar { background: none; border: 0; font-size: 1.9rem; line-height: 1; color: #94a3b8; cursor: pointer; padding: 0 4px; }
.ref-cerrar:hover { color: #334155; }

.ref-panel__buscar { position: relative; padding: 16px 22px; background: #fff; border-bottom: 1px solid #e2e8f0; }
.ref-panel__buscar > i { position: absolute; left: 36px; top: 50%; transform: translateY(-50%); color: #94a3b8; }
.ref-panel__buscar input {
    width: 100%; padding: 11px 14px 11px 40px; border-radius: 9px;
    border: 1.5px solid #e2e8f0; font-family: inherit; font-size: .92rem; background: #f8fafc;
}
.ref-panel__buscar input:focus { outline: none; border-color: #0f766e; background: #fff; }

.ref-sugerencias {
    position: absolute; left: 22px; right: 22px; top: calc(100% - 6px); z-index: 5;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
    box-shadow: 0 12px 30px rgba(15,23,42,.14); max-height: 330px; overflow-y: auto;
}
.ref-sugerencias button {
    display: block; width: 100%; text-align: left; padding: 11px 16px;
    background: none; border: 0; border-bottom: 1px solid #f1f5f9; cursor: pointer; font-family: inherit;
}
.ref-sugerencias button:last-child { border-bottom: 0; }
.ref-sugerencias button:hover { background: #f0fdfa; }
.ref-sugerencias strong { display: block; font-size: .9rem; color: #0f172a; }
.ref-sugerencias small { font-size: .78rem; color: #94a3b8; }
.ref-sin { margin: 0; padding: 16px; color: #94a3b8; font-size: .88rem; }

.ref-panel__cuerpo { flex: 1; overflow-y: auto; padding: 20px 22px; }
.ref-ayuda { margin: 0 0 16px; font-size: .87rem; color: #64748b; line-height: 1.5; }
.ref-cargando { color: #94a3b8; font-size: .9rem; }

/* ── Listado de clientes con números ────────────────────────────────────── */
.ref-listado { display: grid; gap: 8px; }
.ref-cliente {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    width: 100%; padding: 13px 16px; cursor: pointer; font-family: inherit; text-align: left;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 9px; transition: all .18s;
}
.ref-cliente:hover { border-color: #0f766e; background: #f0fdfa; }
.ref-cliente__nombre { font-size: .92rem; font-weight: 600; color: #0f172a; }
.ref-cliente__n {
    flex: none; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px;
    background: #ccfbf1; color: #115e59; font-size: .78rem; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
}

/* ── Ficha de un cliente ────────────────────────────────────────────────── */
.ref-ficha__cab { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.ref-volver {
    display: inline-flex; align-items: center; gap: 6px; flex: none;
    padding: 7px 12px; border-radius: 7px; cursor: pointer; font-family: inherit;
    background: #f1f5f9; border: 1px solid #e2e8f0; color: #475569; font-size: .82rem; font-weight: 600;
}
.ref-volver:hover { background: #e2e8f0; }
.ref-ficha__cab h3 { margin: 0; font-size: 1.02rem; color: #0f172a; }
.ref-ficha__cab small { font-size: .78rem; color: #94a3b8; }

.ref-filas { display: grid; gap: 8px; margin-bottom: 14px; }
.ref-fila {
    display: grid; grid-template-columns: 150px 1fr auto auto; gap: 8px; align-items: center;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 9px; padding: 8px 10px;
}
.ref-fila--apagada { opacity: .5; }
.ref-fila input[type="text"] {
    width: 100%; padding: 8px 11px; border-radius: 7px; border: 1px solid #e2e8f0;
    font-family: inherit; font-size: .88rem; color: #0f172a;
}
.ref-fila input[type="text"]:focus { outline: none; border-color: #0f766e; }
.ref-num { font-variant-numeric: tabular-nums; font-weight: 600; }

.ref-activo { cursor: pointer; }
.ref-activo input { position: absolute; opacity: 0; width: 0; height: 0; }
.ref-activo span { display: block; position: relative; width: 34px; height: 20px; background: #cbd5e1; border-radius: 999px; transition: background .25s; }
.ref-activo span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; background: #fff; border-radius: 50%; transition: transform .25s; }
.ref-activo input:checked + span { background: #0f766e; }
.ref-activo input:checked + span::after { transform: translateX(14px); }

.ref-quitar { background: none; border: 0; font-size: 1.5rem; line-height: 1; color: #cbd5e1; cursor: pointer; padding: 0 6px; }
.ref-quitar:hover { color: #dc2626; }
.ref-sin-filas { margin: 0; padding: 22px; text-align: center; color: #94a3b8; font-size: .88rem; background: #fff; border: 1px dashed #e2e8f0; border-radius: 9px; }

.ref-btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 15px; border-radius: 8px; cursor: pointer; font-family: inherit;
    background: #f1f5f9; border: 1px solid #e2e8f0; color: #334155; font-size: .86rem; font-weight: 600;
    transition: all .18s;
}
.ref-btn:hover { background: #e2e8f0; }
.ref-btn--suave { background: #f0fdfa; border-color: #99f6e4; color: #115e59; }
.ref-btn--suave:hover { background: #ccfbf1; }
.ref-btn--azul { background: #0f766e; border-color: #0f766e; color: #fff; }
.ref-btn--azul:hover { background: #115e59; }

.ref-guardar { display: flex; align-items: center; gap: 14px; margin-top: 22px; padding-top: 18px; border-top: 1px solid #e2e8f0; }
.ref-nota { font-size: .84rem; }
.ref-nota--pendiente { color: #b45309; }
.ref-nota--ok { color: #15803d; font-weight: 600; }
.ref-nota--mal { color: #b91c1c; }

.ref-vacio { text-align: center; padding: 46px 20px; color: #64748b; }
.ref-vacio i { font-size: 2.4rem; color: #ccfbf1; margin-bottom: 14px; display: block; }
.ref-vacio h3 { margin: 0 0 8px; font-size: 1rem; color: #334155; }
.ref-vacio p { margin: 0 auto; max-width: 360px; font-size: .87rem; line-height: 1.55; }

@media (max-width: 640px) {
    .ref-panel__caja { width: 100%; }
    .ref-fila { grid-template-columns: 1fr auto auto; }
    .ref-fila .ref-num { grid-column: 1 / -1; }
}
